summaryrefslogtreecommitdiff
path: root/src/libstddjb/buffer_write.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-02-01 12:06:52 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-02-01 12:06:52 +0000
commited49b72c0a31b6034026948851edf11cfa990fa0 (patch)
treeae33dbab4122f47187a72ef49834e107e316bdea /src/libstddjb/buffer_write.c
parent334d7f09d8dec83b9399e2cc44490b3868cd0772 (diff)
downloadskalibs-ed49b72c0a31b6034026948851edf11cfa990fa0.tar.xz
Add allreadwritev and friends
Diffstat (limited to 'src/libstddjb/buffer_write.c')
-rw-r--r--src/libstddjb/buffer_write.c7
1 files changed, 2 insertions, 5 deletions
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 ;
}