[lxc-devel] [PATCH 2/7] coverity: Check return value of fcntl in lxc_popen

Serge Hallyn serge.hallyn at ubuntu.com
Wed Feb 12 21:56:08 UTC 2014


Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>

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

> ---
>  src/lxc/utils.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/utils.c b/src/lxc/utils.c
> index b7a29cb..90401a5 100644
> --- a/src/lxc/utils.c
> +++ b/src/lxc/utils.c
> @@ -642,7 +642,10 @@ extern struct lxc_popen_FILE *lxc_popen(const char *command)
>  			 * But it must not be marked close-on-exec.
>  			 * Undo the effects.
>  			 */
> -			fcntl(child_end, F_SETFD, 0);
> +			if (fcntl(child_end, F_SETFD, 0) != 0) {
> +				SYSERROR("Failed to remove FD_CLOEXEC from fd.");
> +				exit(127);
> +			}
>  		}
>  
>  		/*
> -- 
> 1.9.rc1
> 
> _______________________________________________
> 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