]> granicus.if.org Git - curl/commitdiff
write: add return code checks when used
authorDaniel Stenberg <daniel@haxx.se>
Sat, 11 Jun 2011 21:01:09 +0000 (23:01 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 11 Jun 2011 21:01:09 +0000 (23:01 +0200)
These were just warnings in test code but it still makes it nicer to not
generate them.

tests/libtest/lib556.c
tests/server/tftpd.c

index da29a46788091f29250c7c64e4ead0e8bc6bf00f..67da87f4079b2d7ec48bda30cdf1d48adcbfcfdc 100644 (file)
@@ -84,9 +84,11 @@ int test(char *URL)
         sleep(1); /* avoid ctl-10 dump */
 #endif
 
-        if(iolen)
+        if(iolen) {
           /* send received stuff to stdout */
-          write(STDOUT_FILENO, buf, iolen);
+          if(!write(STDOUT_FILENO, buf, iolen))
+            break;
+        }
         total += iolen;
 
       } while(((res == CURLE_OK) || (res == CURLE_AGAIN)) && (total < 129));
index 9a4717723162e0bfaeafea79c09cf94ec4433342..92fb717b76aca20d74e0495276a75c6770b6aab7 100644 (file)
@@ -605,7 +605,8 @@ static ssize_t write_behind(struct testcase *test, int convert)
     }
     /* formerly
        putc(c, file); */
-    write(test->ofile, &c, 1);
+    if(1 != write(test->ofile, &c, 1))
+      break;
     skipit:
     prevchar = c;
   }