]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix a compile warning with -DDEBUG.
authorSimon Tatham <anakin@pobox.com>
Mon, 18 May 2015 20:17:21 +0000 (21:17 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 20 Jun 2015 11:47:42 +0000 (12:47 +0100)
An unguarded write() in the dputs function caused gcc -Werror to fail
to compile. I'm confused that this hasn't bitten me before, though -
obviously normal builds of PuTTY condition out the faulty code, but
_surely_ this can't be the first time I've enabled the developer
diagnostics since gcc started complaining about unchecked syscall
returns!

(cherry picked from commit 35fde00fd1fdc084a78dc3e4c3f94dbf16bbd236)

unix/uxmisc.c

index 473aa94ef899b8a6862a0d1f8026deae7b106a97..e65a3869b8141ea77cb796a6cdfb83361b275b71 100644 (file)
@@ -103,7 +103,7 @@ void dputs(char *buf)
        debug_fp = fopen("debug.log", "w");
     }
 
-    write(1, buf, strlen(buf));
+    if (write(1, buf, strlen(buf)) < 0) {} /* 'error check' to placate gcc */
 
     fputs(buf, debug_fp);
     fflush(debug_fp);