iov: Fix do_send_recv() for MinGW (also fixes a build breakage)
Commit 25e5e4c7
broke compilation for non POSIX hosts (e.g. MinGW)
because it partially replaced "ret" by "count".
It also changed the handling of EINTR in a wrong way.
The patch restores the old code for these two changes.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
31783203c3
commit
c0958559b1
11
iov.c
11
iov.c
@ -114,9 +114,9 @@ do_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt, bool do_send)
|
|||||||
#else
|
#else
|
||||||
/* else send piece-by-piece */
|
/* else send piece-by-piece */
|
||||||
/*XXX Note: windows has WSASend() and WSARecv() */
|
/*XXX Note: windows has WSASend() and WSARecv() */
|
||||||
unsigned i;
|
unsigned i = 0;
|
||||||
size_t count = 0;
|
ssize_t ret = 0;
|
||||||
for (i = 0; i < iov_cnt; ++i) {
|
while (i < iov_cnt) {
|
||||||
ssize_t r = do_send
|
ssize_t r = do_send
|
||||||
? send(sockfd, iov[i].iov_base, iov[i].iov_len, 0)
|
? send(sockfd, iov[i].iov_base, iov[i].iov_len, 0)
|
||||||
: recv(sockfd, iov[i].iov_base, iov[i].iov_len, 0);
|
: recv(sockfd, iov[i].iov_base, iov[i].iov_len, 0);
|
||||||
@ -130,12 +130,13 @@ do_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt, bool do_send)
|
|||||||
/* else it is some "other" error,
|
/* else it is some "other" error,
|
||||||
* only return if there was no data processed. */
|
* only return if there was no data processed. */
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
return -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return count;
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user