aboutsummaryrefslogtreecommitdiff
path: root/slirp/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'slirp/socket.c')
-rw-r--r--slirp/socket.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/slirp/socket.c b/slirp/socket.c
index fe03d448a5..6713c4d5e7 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -175,8 +175,12 @@ soread(so)
* a close will be detected on next iteration.
* A return of -1 wont (shouldn't) happen, since it didn't happen above
*/
- if (n == 2 && nn == iov[0].iov_len)
- nn += recv(so->s, iov[1].iov_base, iov[1].iov_len,0);
+ if (n == 2 && nn == iov[0].iov_len) {
+ int ret;
+ ret = recv(so->s, iov[1].iov_base, iov[1].iov_len,0);
+ if (ret > 0)
+ nn += ret;
+ }
DEBUG_MISC((dfd, " ... read nn = %d bytes\n", nn));
#endif