From 920baab81f98a3cae3436361cdd044afe21fe347 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 4 Jul 2012 12:21:22 -0400 Subject: [PATCH] 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. --- src/stdio/putw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }