Workarounds for compiling with -D_FORTIFY_SOURCE=2 (as Ubuntu does), which
[u/mdw/putty] / unix / uxplink.c
index 0c34a29..cbfcc71 100644 (file)
@@ -107,8 +107,8 @@ char *platform_default_s(const char *name)
 {
     if (!strcmp(name, "TermType"))
        return dupstr(getenv("TERM"));
-    if (!strcmp(name, "UserName"))
-       return get_username();
+     if (!strcmp(name, "UserName"))
+       return get_username();
     if (!strcmp(name, "SerialLine"))
        return dupstr("/dev/ttyS0");
     return NULL;
@@ -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);
        }