summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/stdio.c3
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)) {