1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 11:02:48 -05:00

Workarounds for compiling with -D_FORTIFY_SOURCE=2 (as Ubuntu does), which

doesn't like you to ignore the return value from read()/write()/etc (and
apparently can't be shut up with a cast to void).

[originally from svn r8614]
This commit is contained in:
Jacob Nevins
2009-08-07 00:19:04 +00:00
parent 9c1f81dd94
commit 4bddcc2b5d
6 changed files with 24 additions and 10 deletions

View File

@ -161,7 +161,8 @@ int verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
newmode.c_lflag |= ECHO | ISIG | ICANON;
tcsetattr(0, TCSANOW, &newmode);
line[0] = '\0';
read(0, line, sizeof(line) - 1);
if (read(0, line, sizeof(line) - 1) <= 0)
/* handled below */;
tcsetattr(0, TCSANOW, &oldmode);
}
@ -213,7 +214,8 @@ int askalg(void *frontend, const char *algtype, const char *algname,
newmode.c_lflag |= ECHO | ISIG | ICANON;
tcsetattr(0, TCSANOW, &newmode);
line[0] = '\0';
read(0, line, sizeof(line) - 1);
if (read(0, line, sizeof(line) - 1) <= 0)
/* handled below */;
tcsetattr(0, TCSANOW, &oldmode);
}
@ -266,7 +268,8 @@ int askappend(void *frontend, Filename filename,
newmode.c_lflag |= ECHO | ISIG | ICANON;
tcsetattr(0, TCSANOW, &newmode);
line[0] = '\0';
read(0, line, sizeof(line) - 1);
if (read(0, line, sizeof(line) - 1) <= 0)
/* handled below */;
tcsetattr(0, TCSANOW, &oldmode);
}

View File

@ -513,7 +513,8 @@ int signalpipe[2];
void sigwinch(int signum)
{
write(signalpipe[1], "x", 1);
if (write(signalpipe[1], "x", 1) <= 0)
/* not much we can do about it */;
}
/*
@ -1030,7 +1031,9 @@ int main(int argc, char **argv)
if (FD_ISSET(signalpipe[0], &rset)) {
char c[1];
struct winsize size;
read(signalpipe[0], c, 1); /* ignore its value; it'll be `x' */
if (read(signalpipe[0], c, 1) <= 0)
/* ignore error */;
/* ignore its value; it'll be `x' */
if (ioctl(0, TIOCGWINSZ, (void *)&size) >= 0)
back->size(backhandle, size.ws_col, size.ws_row);
}

View File

@ -260,7 +260,8 @@ static void cleanup_utmp(void)
static void sigchld_handler(int signum)
{
write(pty_signal_pipe[1], "x", 1);
if (write(pty_signal_pipe[1], "x", 1) <= 0)
/* not much we can do about it */;
}
#ifndef OMIT_UTMP
@ -633,7 +634,9 @@ int pty_select_result(int fd, int event)
int status;
char c[1];
read(pty_signal_pipe[0], c, 1); /* ignore its value; it'll be `x' */
if (read(pty_signal_pipe[0], c, 1) <= 0)
/* ignore error */;
/* ignore its value; it'll be `x' */
do {
pid = waitpid(-1, &status, WNOHANG);