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

Re: [libvirt] [PATCH] libvirtd.c: avoid closing a negative socket file descriptor



On Tue, Feb 02, 2010 at 11:28:07AM +0100, Jim Meyering wrote:
> A lot like the last one...
> 
> >From e32826290b960790b0ec4f50b195f424fa42348f Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Tue, 2 Feb 2010 11:27:25 +0100
> Subject: [PATCH] libvirtd.c: avoid closing a negative socket file descriptor
> 
> * daemon/libvirtd.c (qemudListenUnix): Close socket only if non-negative.
> ---
>  daemon/libvirtd.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> index 3070dfc..f7df0c6 100644
> --- a/daemon/libvirtd.c
> +++ b/daemon/libvirtd.c
> @@ -1,7 +1,7 @@
>  /*
>   * libvirtd.c: daemon start of day, guest process & i/o management
>   *
> - * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
> + * Copyright (C) 2006-2010, 2010 Red Hat, Inc.
>   * Copyright (C) 2006 Daniel P. Berrange
>   *
>   * This library is free software; you can redistribute it and/or
> @@ -582,7 +582,7 @@ static int qemudListenUnix(struct qemud_server *server,
>      return 0;
> 
>   cleanup:
> -    if (sock->fd)
> +    if (0 <= sock->fd)
>          close(sock->fd);
>      VIR_FREE(sock);
>      return -1;

This conditional is also written the wrong way around

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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