diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2001-05-07 20:17:35 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2001-05-07 20:17:35 +0000 |
commit | f3116452b49a17a1b561a9fa082644bcb9c7a556 (patch) | |
tree | d1b387dbd63f3442905ce7837a0bbc7b4234c777 | |
parent | 4e88ea446cbc773e8f8633a6fc7bda2c155ed20a (diff) |
Fix fwrite return value bug reported by Matthias Kilian <kili@outback.escape.de>.
-rw-r--r-- | libc/stdio/stdio.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c index a7dd8a3ba..d3732dbdb 100644 --- a/libc/stdio/stdio.c +++ b/libc/stdio/stdio.c @@ -512,12 +512,13 @@ off_t _uClibc_fwrite(const unsigned char *buf, off_t bytes, FILE *fp) } FFLUSH: /* If we get here, either buffer is full or we need to flush anyway. */ + buf = fp->bufpos - (p - (unsigned char *)buf); p = NULL; } if (!p) { /* buf == NULL means fflush */ p = fp->bufstart; bytes = fp->bufpos - p; - buf = fp->bufpos = fp->bufwrite = p; + fp->bufpos = fp->bufwrite = p; } else if (fp->bufpos > fp->bufstart) { /* If there are buffered chars, */ _uClibc_fwrite(NULL, 0, fp); /* write them. */ if (ferror(fp)) { |