Fix test rw_blocking

This commit is contained in:
Vitaliy Filippov
2021-12-12 23:24:50 +03:00
parent 616c18c786
commit e544aef7d0
2 changed files with 8 additions and 6 deletions
+6 -4
View File
@@ -60,7 +60,7 @@ int readv_blocking(int fd, iovec *iov, int iovcnt)
int done = 0;
while (v < iovcnt)
{
ssize_t r = readv(fd, iov, iovcnt);
ssize_t r = readv(fd, iov+v, iovcnt-v);
if (r < 0)
{
if (errno != EAGAIN && errno != EPIPE)
@@ -70,6 +70,7 @@ int readv_blocking(int fd, iovec *iov, int iovcnt)
}
continue;
}
done += r;
while (v < iovcnt)
{
if (iov[v].iov_len > r)
@@ -80,10 +81,10 @@ int readv_blocking(int fd, iovec *iov, int iovcnt)
}
else
{
r -= iov[v].iov_len;
v++;
}
}
done += r;
}
return done;
}
@@ -94,7 +95,7 @@ int writev_blocking(int fd, iovec *iov, int iovcnt)
int done = 0;
while (v < iovcnt)
{
ssize_t r = writev(fd, iov, iovcnt);
ssize_t r = writev(fd, iov+v, iovcnt-v);
if (r < 0)
{
if (errno != EAGAIN && errno != EPIPE)
@@ -104,6 +105,7 @@ int writev_blocking(int fd, iovec *iov, int iovcnt)
}
continue;
}
done += r;
while (v < iovcnt)
{
if (iov[v].iov_len > r)
@@ -114,10 +116,10 @@ int writev_blocking(int fd, iovec *iov, int iovcnt)
}
else
{
r -= iov[v].iov_len;
v++;
}
}
done += r;
}
return done;
}