[lxc-devel] [PATCH 5/6] coverity: Check fcntl return value
Serge Hallyn
serge.hallyn at ubuntu.com
Sat Feb 15 00:02:23 UTC 2014
Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
I notice there are two more in conf.c and one in sync.c
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> src/lxc/attach.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/lxc/attach.c b/src/lxc/attach.c
> index 28cf916..a59dae3 100644
> --- a/src/lxc/attach.c
> +++ b/src/lxc/attach.c
> @@ -1026,8 +1026,11 @@ static int attach_child_main(void* data)
> flags = fcntl(fd, F_GETFL);
> if (flags < 0)
> continue;
> - if (flags & FD_CLOEXEC)
> - fcntl(fd, F_SETFL, flags & ~FD_CLOEXEC);
> + if (flags & FD_CLOEXEC) {
> + if (fcntl(fd, F_SETFL, flags & ~FD_CLOEXEC) < 0) {
> + SYSERROR("Unable to clear CLOEXEC from fd");
> + }
> + }
> }
>
> /* we're done, so we can now do whatever the user intended us to do */
> --
> 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