From ed49b72c0a31b6034026948851edf11cfa990fa0 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 1 Feb 2015 12:06:52 +0000 Subject: Add allreadwritev and friends --- src/libstddjb/allreadwrite.c | 1 - src/libstddjb/buffer_write.c | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src/libstddjb') diff --git a/src/libstddjb/allreadwrite.c b/src/libstddjb/allreadwrite.c index 7e7867b..c15f6de 100644 --- a/src/libstddjb/allreadwrite.c +++ b/src/libstddjb/allreadwrite.c @@ -9,7 +9,6 @@ unsigned int allreadwrite (iofunc_t_ref op, int fd, register char *buf, register while (len) { register int w = (*op)(fd, buf, len) ; - if (!w) errno = EPIPE ; if (w <= 0) break ; written += w ; buf += w ; diff --git a/src/libstddjb/buffer_write.c b/src/libstddjb/buffer_write.c index e669f60..b924cbb 100644 --- a/src/libstddjb/buffer_write.c +++ b/src/libstddjb/buffer_write.c @@ -1,14 +1,11 @@ /* ISC license. */ -#include -#include #include #include #include int buffer_write (int fd, siovec_t const *v, unsigned int n) { - struct iovec iov[n] ; - iovec_from_siovec(iov, v, n) ; - return fd_writev(fd, iov, n) ; + unsigned int w = allreadwritev(&fd_writesv, fd, v, n) ; + return w ? (int)w : -1 ; } -- cgit v1.2.3