aboutgitcodebugslistschat
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/util.c b/util.c
index 3b2393d..849fa7f 100644
--- a/util.c
+++ b/util.c
@@ -533,13 +533,14 @@ int do_clone(int (*fn)(void *), char *stack_area, size_t stack_size, int flags,
int write_remainder(int fd, const struct iovec *iov, int iovcnt, size_t skip)
{
int i;
+ size_t offset;
- while ((i = iov_skip_bytes(iov, iovcnt, skip, &skip)) < iovcnt) {
+ while ((i = iov_skip_bytes(iov, iovcnt, skip, &offset)) < iovcnt) {
ssize_t rc;
- if (skip) {
- rc = write(fd, (char *)iov[i].iov_base + skip,
- iov[i].iov_len - skip);
+ if (offset) {
+ rc = write(fd, (char *)iov[i].iov_base + offset,
+ iov[i].iov_len - offset);
} else {
rc = writev(fd, &iov[i], iovcnt - i);
}