]> granicus.if.org Git - musl/commitdiff
putw is supposed to return 0 (not the value written) on success
authorRich Felker <dalias@aerifal.cx>
Wed, 4 Jul 2012 16:21:22 +0000 (12:21 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 4 Jul 2012 16:21:22 +0000 (12:21 -0400)
this is not a standard but it's the traditional behavior and it's more
useful because the caller can reliably detect errors.

src/stdio/putw.c

index a6d2429278a67f3df5061c041fc113b1fd2d350e..0ff9d7fbffb98a5d5919a3e8658678095674a3b7 100644 (file)
@@ -3,5 +3,5 @@
 
 int putw(int x, FILE *f)
 {
-       return fwrite(&x, sizeof x, 1, f) ? x : EOF;
+       return (int)fwrite(&x, sizeof x, 1, f)-1;
 }