summaryrefslogtreecommitdiff
path: root/src/stdio/putw.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-07-04 12:21:22 -0400
committerRich Felker <dalias@aerifal.cx>2012-07-04 12:21:22 -0400
commit920baab81f98a3cae3436361cdd044afe21fe347 (patch)
tree91238819c21d0cb3c5a4555857e1645028027203 /src/stdio/putw.c
parent98eddc677609c20796982f3171165700613e3cf2 (diff)
downloadmusl-920baab81f98a3cae3436361cdd044afe21fe347.tar.gz
musl-920baab81f98a3cae3436361cdd044afe21fe347.tar.bz2
musl-920baab81f98a3cae3436361cdd044afe21fe347.tar.xz
musl-920baab81f98a3cae3436361cdd044afe21fe347.zip
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.
Diffstat (limited to 'src/stdio/putw.c')
-rw-r--r--src/stdio/putw.c2
1 files changed, 1 insertions, 1 deletions
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;
}