also ensure that write buffer is bounded when __stdio_write returns
[musl] / src / stdio / __stdio_write.c
index dd97cf6..da45673 100644 (file)
@@ -22,6 +22,7 @@ size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len)
                cnt = syscall_cp(SYS_writev, f->fd, iov, iovcnt);
                pthread_cleanup_pop(0);
                if (cnt == rem) {
+                       f->wend = f->buf + f->buf_size;
                        f->wpos = f->wbase = f->buf;
                        return len;
                }