X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2F__stdio_write.c;h=d2d89475b0f9429dca8b538b689f97c27bbe5fee;hb=54316a52b2119edf73e274c8b4f25d7757f7b4d3;hp=8c89389a574eb6061131cd926f2322f9a0967837;hpb=dab441aea240f3b7c18a26d2ef51979ea36c301c;p=musl diff --git a/src/stdio/__stdio_write.c b/src/stdio/__stdio_write.c index 8c89389a..d2d89475 100644 --- a/src/stdio/__stdio_write.c +++ b/src/stdio/__stdio_write.c @@ -1,12 +1,5 @@ #include "stdio_impl.h" #include -#include - -static void cleanup(void *p) -{ - FILE *f = p; - if (!f->lockcount) __unlockfile(f); -} size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) { @@ -19,9 +12,7 @@ size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) int iovcnt = 2; ssize_t cnt; for (;;) { - pthread_cleanup_push(cleanup, f); - cnt = syscall_cp(SYS_writev, f->fd, iov, iovcnt); - pthread_cleanup_pop(0); + cnt = syscall(SYS_writev, f->fd, iov, iovcnt); if (cnt == rem) { f->wend = f->buf + f->buf_size; f->wpos = f->wbase = f->buf; @@ -34,11 +25,8 @@ size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) } rem -= cnt; if (cnt > iov[0].iov_len) { - f->wpos = f->wbase = f->buf; cnt -= iov[0].iov_len; iov++; iovcnt--; - } else if (iovcnt == 2) { - f->wbase += cnt; } iov[0].iov_base = (char *)iov[0].iov_base + cnt; iov[0].iov_len -= cnt;