diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-11-21 20:02:08 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-11-21 20:02:08 +0000 |
commit | d4500635534af4c243e29dbb9dae1e03f24527c9 (patch) | |
tree | a51781f9287913bdac0f550da7923f5af04277dc | |
parent | 9264606d92c74c42bcca07b228edb493dc5f6e18 (diff) | |
download | slirp-d4500635534af4c243e29dbb9dae1e03f24527c9.zip slirp-d4500635534af4c243e29dbb9dae1e03f24527c9.tar.gz slirp-d4500635534af4c243e29dbb9dae1e03f24527c9.tar.bz2 |
fixed invalid received length
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1155 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | socket.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -167,8 +167,12 @@ int soread(so) struct socket *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 |