shithub: puzzles

Download patch

ref: 17334d19452b8818865c31bf2e42d2cf334c1f02
parent: ba08d8ab28cb26cf3f743acf0e9c9df13bbb5d3e
author: Simon Tatham <anakin@pobox.com>
date: Fri Dec 12 14:49:05 EST 2008

Don't ignore the return code of fwrite(). (Slight modification of a
patch from Phil Bordelon.)

[originally from svn r8373]

--- a/obfusc.c
+++ b/obfusc.c
@@ -114,7 +114,11 @@
     obfuscate_bitmap(data, datalen * 8, decode);
 
     if (outputmode == BINARY) {
-	fwrite(data, 1, datalen, stdout);
+	int ret = fwrite(data, 1, datalen, stdout);
+        if (ret < 0) {
+            fprintf(stderr, "obfusc: write: %s\n", strerror(errno));
+            return 1;
+        }
     } else {
 	int i;
 	for (i = 0; i < datalen; i++)