summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-11-19 07:21:10 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-11-19 07:21:10 +0000
commit9d94b79b364e6a7d36391bda9a9e717bc1474b18 (patch)
treed0f9116ad74a33e14f2b2d011d375d64803daefd /libc/stdio/stdio.c
parent906eb2c0704f3d1da5d02d1a932fe49677faa4d7 (diff)
Fix the return value for fputs when passed an empty string.
Indirectly detected by gmp-4.1.2 self-tests and reported by "Peter S. Mazinger" <ps.m@gmx.net>.
Diffstat (limited to 'libc/stdio/stdio.c')
-rw-r--r--libc/stdio/stdio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c
index 4d8f2242a..e92a0bb00 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -77,6 +77,9 @@
* Minor thread locking optimizations to avoid some unnecessary locking.
* Remove the explicit calls to __builtin_* funcs, as we really need to
* implement a more general solution.
+ *
+ * Nov 17, 2003
+ * Fix the return value for fputs when passed an empty string.
*/
/* Before we include anything, convert L_ctermid to L_ctermid_function
@@ -2862,7 +2865,7 @@ UNLOCKED(int,fputs,
#ifdef __STDIO_WIDE
- return (fwrite_unlocked(s, n, (size_t) 1, stream) > 0) ? n : EOF;
+ return (fwrite_unlocked(s, (size_t) 1, n, stream) == n) ? n : EOF;
#else /* __STDIO_WIDE */