diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2015-02-01 12:06:52 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2015-02-01 12:06:52 +0000 |
commit | ed49b72c0a31b6034026948851edf11cfa990fa0 (patch) | |
tree | ae33dbab4122f47187a72ef49834e107e316bdea /src/libstddjb | |
parent | 334d7f09d8dec83b9399e2cc44490b3868cd0772 (diff) | |
download | skalibs-ed49b72c0a31b6034026948851edf11cfa990fa0.tar.xz |
Add allreadwritev and friends
Diffstat (limited to 'src/libstddjb')
-rw-r--r-- | src/libstddjb/allreadwrite.c | 1 | ||||
-rw-r--r-- | src/libstddjb/buffer_write.c | 7 |
2 files changed, 2 insertions, 6 deletions
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 <sys/types.h> -#include <sys/uio.h> #include <skalibs/allreadwrite.h> #include <skalibs/siovec.h> #include <skalibs/buffer.h> 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 ; } |