[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv2] slirp: Fix spurious error report when sending
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCHv2] slirp: Fix spurious error report when sending directly |
Date: |
Thu, 31 May 2018 20:02:18 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 05/31/2018 05:31 PM, Samuel Thibault wrote:
> Move check to where it actually is useful, and reduce scope of 'len'
> variable along the way.
>
> Signed-off-by: Samuel Thibault <address@hidden>
Thanks!
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>
> Difference from v1:
> - move check instead of initializing len.
>
> slirp/socket.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/slirp/socket.c b/slirp/socket.c
> index e2a71c9b04..08fe98907d 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;
> }
>