Skip to content

Commit

Permalink
slirp: Fix spurious error report when sending directly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
sthibaul committed Jun 1, 2018
1 parent 9be4af1 commit c7950fb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions slirp/socket.c
Expand Up @@ -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);
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit c7950fb

Please sign in to comment.