int bytes = 0;
while (len) {
- int ret = splice(nd->pipes[1], NULL, f->fd, NULL, len, 0);
+ int ret = splice(f->fd, NULL, nd->pipes[1], NULL, len, 0);
if (ret < 0) {
if (!bytes)
break;
bytes += ret;
+ len -= ret;
}
return bytes;
break;
iov.iov_len -= ret;
+ bytes += ret;
if (iov.iov_len)
iov.iov_base += ret;
}