]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: check return value of fcntl in usernsexec
authorStéphane Graber <stgraber@ubuntu.com>
Wed, 12 Feb 2014 21:08:08 +0000 (16:08 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 12 Feb 2014 22:03:55 +0000 (17:03 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc_usernsexec.c

index b82bcf8dac2caaeb193f7a41f70adb0c6ef0e3c9..e40fa53dffb004b658f2aff266ae41afd2651db2 100644 (file)
@@ -69,13 +69,16 @@ static void opentty(const char * tty) {
 
        fd = open(tty, O_RDWR | O_NONBLOCK);
        if (fd == -1) {
-               printf("WARN: could not reopen tty: %s", strerror(errno));
+               printf("WARN: could not reopen tty: %s\n", strerror(errno));
                return;
        }
 
        flags = fcntl(fd, F_GETFL);
        flags &= ~O_NONBLOCK;
-       fcntl(fd, F_SETFL, flags);
+       if (fcntl(fd, F_SETFL, flags) < 0) {
+               printf("WARN: could not set fd flags: %s\n", strerror(errno));
+               return;
+       }
 
        for (i = 0; i < fd; i++)
                close(i);