qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 09/10] tcp_close(): check for close() errors too


From: Dong Xu Wang
Subject: Re: [Qemu-devel] [PATCH 09/10] tcp_close(): check for close() errors too
Date: Thu, 10 Nov 2011 16:21:46 +0800

2011/11/10 Eduardo Habkost <address@hidden>:
> In case close() fails, we want to report the error back.
>
> Signed-off-by: Eduardo Habkost <address@hidden>
> ---
>  migration-tcp.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/migration-tcp.c b/migration-tcp.c
> index 5aa742c..fd5fd56 100644
> --- a/migration-tcp.c
> +++ b/migration-tcp.c
> @ -40,12 +40,14 @@ static int socket_write(MigrationState *s, const void * 
> buf, size_t size)
>
>  static int tcp_close(MigrationState *s)
>  {
> +    int r = 0;
>     DPRINTF("tcp_close\n");
>     if (s->fd != -1) {
> -        close(s->fd);
> +        if (close(s->fd) < 0)
> +            r = -errno;
Braces {} are necessary, or checkpatch.pl will give warnings, also in
other patches in your series.

No mistake, just reminder. :)
>         s->fd = -1;
>     }
> -    return 0;
> +    return r;
>  }
>
>  static void tcp_wait_for_connect(void *opaque)
> --
> 1.7.3.2
>
>
>



-- 
Regards
Robert Wang



reply via email to

[Prev in Thread] Current Thread [Next in Thread]