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

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



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



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