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

Re: [Libguestfs] [PATCH libguestfs 2/8] build: suppress an ignored-dup-return-value warning



On Tue, Aug 18, 2009 at 03:49:39PM +0200, Jim Meyering wrote:
> From: Jim Meyering <meyering redhat com>
> 
> * src/guestfs.c (guestfs_launch): Handle dup failure.
> ---
>  src/guestfs.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/src/guestfs.c b/src/guestfs.c
> index ecdf9e5..1cd4f9e 100644
> --- a/src/guestfs.c
> +++ b/src/guestfs.c
> @@ -1162,11 +1162,18 @@ guestfs_launch (guestfs_h *g)
>      close (1);
>      close (wfd[1]);
>      close (rfd[0]);
> -    dup (wfd[0]);
> -    dup (rfd[1]);
> +
> +    int fail = 0;
> +    fail |= dup (wfd[0]);
> +    fail |= dup (rfd[1]);
>      close (wfd[0]);
>      close (rfd[1]);
> 
> +    if (fail) {
> +      perror ("dup failed");
> +      _exit (1);
> +    }
> +
>  #if 0
>      /* Set up a new process group, so we can signal this process
>       * and all subprocesses (eg. if qemu is really a shell script).
> -- 
> 1.6.4.378.g88f2f

Obvious improvement, ACK.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw


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