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

Daniel Veillard veillard at redhat.com
Tue Feb 2 13:01:37 UTC 2010


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 at 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;

  And same feedback, please swap order before commit :-)

  ACK

  thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list