summaryrefslogtreecommitdiff
path: root/src/libstddjb/allreadwritev.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/allreadwritev.c')
-rw-r--r--src/libstddjb/allreadwritev.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/libstddjb/allreadwritev.c b/src/libstddjb/allreadwritev.c
index 28695a1..2b06ac7 100644
--- a/src/libstddjb/allreadwritev.c
+++ b/src/libstddjb/allreadwritev.c
@@ -1,18 +1,20 @@
/* ISC license. */
-#include <errno.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <skalibs/functypes.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/siovec.h>
-unsigned int allreadwritev (iovfunc_t_ref op, int fd, siovec_t const *v, unsigned int vlen)
+size_t allreadwritev (iovfunc_t_ref op, int fd, struct iovec const *v, unsigned int vlen)
{
- register unsigned int written = 0 ;
- siovec_t vv[vlen] ;
- for (; written < vlen ; written++) vv[written] = v[written] ;
- written = 0 ;
+ size_t written = 0 ;
+ struct iovec vv[vlen] ;
+ unsigned int i = 0 ;
+ for (; i < vlen ; i++) vv[i] = v[i] ;
while (siovec_len(vv, vlen))
{
- register int w = (*op)(fd, vv, vlen) ;
+ register ssize_t w = (*op)(fd, vv, vlen) ;
if (w <= 0) break ;
w = siovec_seek(vv, vlen, w) ;
written += w ;