aboutsummaryrefslogtreecommitdiff
path: root/slirp
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-05-31 21:24:19 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-06-01 16:45:49 +0200
commitc7950fb3f3c710a70ac1411b894bed854628a5e1 (patch)
tree7e66e679647547bd58ffa4b8b36f56ce5e901b6d /slirp
parent9be4af13305f24d2dabf94bb53e6b65c76d08bb2 (diff)
downloadqemu-c7950fb3f3c710a70ac1411b894bed854628a5e1.zip
qemu-c7950fb3f3c710a70ac1411b894bed854628a5e1.tar.gz
qemu-c7950fb3f3c710a70ac1411b894bed854628a5e1.tar.bz2
slirp: Fix spurious error report when sending directly
Move check to where it actually is useful, and reduce scope of 'len' variable along the way. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'slirp')
-rw-r--r--slirp/socket.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/slirp/socket.c b/slirp/socket.c
index e2a71c9..08fe989 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -340,7 +340,7 @@ sosendoob(struct socket *so)
struct sbuf *sb = &so->so_rcv;
char buff[2048]; /* XXX Shouldn't be sending more oob data than this */
- int n, len;
+ int n;
DEBUG_CALL("sosendoob");
DEBUG_ARG("so = %p", so);
@@ -359,7 +359,7 @@ sosendoob(struct socket *so)
* send it all
*/
uint32_t urgc = so->so_urgc;
- len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr;
+ int len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr;
if (len > urgc) {
len = urgc;
}
@@ -374,13 +374,13 @@ sosendoob(struct socket *so)
len += n;
}
n = slirp_send(so, buff, len, (MSG_OOB)); /* |MSG_DONTWAIT)); */
- }
-
#ifdef DEBUG
- if (n != len) {
- DEBUG_ERROR((dfd, "Didn't send all data urgently XXXXX\n"));
- }
+ if (n != len) {
+ DEBUG_ERROR((dfd, "Didn't send all data urgently XXXXX\n"));
+ }
#endif
+ }
+
if (n < 0) {
return n;
}