From: Rich Felker Date: Wed, 4 Jul 2012 16:21:22 +0000 (-0400) Subject: putw is supposed to return 0 (not the value written) on success X-Git-Tag: v0.9.3~55 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=920baab81f98a3cae3436361cdd044afe21fe347;p=musl putw is supposed to return 0 (not the value written) on success this is not a standard but it's the traditional behavior and it's more useful because the caller can reliably detect errors. --- diff --git a/src/stdio/putw.c b/src/stdio/putw.c index a6d24292..0ff9d7fb 100644 --- a/src/stdio/putw.c +++ b/src/stdio/putw.c @@ -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; }