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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstddjb/allreadwritev.c b/src/libstddjb/allreadwritev.c
index 2b06ac7..5ba3837 100644
--- a/src/libstddjb/allreadwritev.c
+++ b/src/libstddjb/allreadwritev.c
@@ -9,12 +9,12 @@
size_t allreadwritev (iovfunc_t_ref op, int fd, struct iovec const *v, unsigned int vlen)
{
size_t written = 0 ;
- struct iovec vv[vlen] ;
- unsigned int i = 0 ;
- for (; i < vlen ; i++) vv[i] = v[i] ;
+ struct iovec vv[vlen ? vlen : 1] ;
+ unsigned int i = vlen ;
+ while (i--) vv[i] = v[i] ;
while (siovec_len(vv, vlen))
{
- register ssize_t w = (*op)(fd, vv, vlen) ;
+ ssize_t w = (*op)(fd, vv, vlen) ;
if (w <= 0) break ;
w = siovec_seek(vv, vlen, w) ;
written += w ;