[libvirt] [PATCH] ebiptablesWriteToTempFile: don't close a negative file descriptor

Stefan Berger stefanb at linux.vnet.ibm.com
Tue May 18 10:34:10 UTC 2010


On Tue, 2010-05-18 at 10:13 +0200, Jim Meyering wrote:

> 
> >From b7c6593b3a8b59d49b492cd45fbf5f9c706bb78f Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Tue, 18 May 2010 10:11:23 +0200
> Subject: [PATCH] ebiptablesWriteToTempFile: don't close a negative file descriptor
> 
> * src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesWriteToTempFile):
> Skip the close if "fd" is negative.
> ---
>  src/nwfilter/nwfilter_ebiptables_driver.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
> index 63bcbd7..ae21906 100644
> --- a/src/nwfilter/nwfilter_ebiptables_driver.c
> +++ b/src/nwfilter/nwfilter_ebiptables_driver.c
> @@ -2245,7 +2245,8 @@ ebiptablesWriteToTempFile(const char *string) {
> 
>  err_exit:
>      VIR_FREE(header);
> -    close(fd);
> +    if (fd >= 0)
> +        close(fd);
>      unlink(filename);
>      return NULL;
>  }

ACK.

   Stefan





More information about the libvir-list mailing list