summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-01-05 04:47:26 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-01-05 04:47:26 +0000
commit434bf7e8d009867dd85773908859d6429c210102 (patch)
tree91081107a18de843a9abae3c908fb73ac3b82b55 /libc
parent854603b2a050d4403a3ee11c1abefa1ebc36eba2 (diff)
Fix a silly bug in _wstdio_fwrite. wprintf %s should now work correctly.
Diffstat (limited to 'libc')
-rw-r--r--libc/stdio/stdio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c
index e39cf5205..7db727c76 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -48,6 +48,8 @@
*
* Nov 21, 2002
* Added internal function _wstdio_fwrite.
+ * Jan 3, 2003
+ * Fixed a bug in _wstdio_fwrite.
*/
/* Before we include anything, convert L_ctermid to L_ctermid_function
@@ -3514,7 +3516,7 @@ size_t _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
pw = ws;
count = 0;
while (n > count) {
- r = wcsnrtombs(buf, &pw, n, sizeof(buf), &stream->state);
+ r = wcsnrtombs(buf, &pw, n-count, sizeof(buf), &stream->state);
if (r != ((size_t) -1)) { /* No encoding errors */
if (!r) {
++r; /* 0 is returned when nul is reached. */