[lxc-devel] [PATCH] close the fd on error

Serge Hallyn serge.hallyn at ubuntu.com
Sat Jan 25 23:45:47 UTC 2014


Quoting S.Çağlar Onur (caglar at 10ur.org):
> Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>

thanks.

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/lxc/lxccontainer.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index fbf0824..6ea7c11 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -2486,8 +2486,10 @@ static int clone_update_rootfs(struct clone_update_data *data)
>  			SYSERROR("unable to open %s: ignoring\n", path);
>  			return 0;
>  		}
> -		if (fprintf(fout, "%s", c->name) < 0)
> +		if (fprintf(fout, "%s", c->name) < 0) {
> +			fclose(fout);
>  			return -1;
> +        }
>  		if (fclose(fout) < 0)
>  			return -1;
>  	}
> -- 
> 1.8.3.2
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list