]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: Check fcntl return value
authorStéphane Graber <stgraber@ubuntu.com>
Fri, 14 Feb 2014 21:07:41 +0000 (16:07 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Sat, 15 Feb 2014 00:13:49 +0000 (19:13 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/attach.c

index 28cf9163504667a6b06ab9ea8eb5f744e40040e9..a59dae33088ff0acf7e0a9793d252cebdf0044a7 100644 (file)
@@ -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 */