]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1437935
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 12 Jul 2018 15:52:09 +0000 (17:52 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 10 Dec 2018 14:19:40 +0000 (15:19 +0100)
Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_usernsexec.c

index 316eaafcd7a797ce81af54d54deb87782e548243..f3ae38f3226238da9d9bf13231163c75ad0f2d89 100644 (file)
@@ -75,14 +75,15 @@ static void usage(const char *name)
        printf("        calling user permission to use the mapped ranges\n");
 }
 
-static void opentty(const char * tty, int which) {
+static void opentty(const char *tty, int which)
+{
        int fd, flags;
 
        if (tty[0] == '\0')
                return;
 
        fd = open(tty, O_RDWR | O_NONBLOCK);
-       if (fd == -1) {
+       if (fd < 0) {
                printf("WARN: could not reopen tty: %s\n", strerror(errno));
                return;
        }
@@ -97,7 +98,7 @@ static void opentty(const char * tty, int which) {
 
        close(which);
        if (fd != which) {
-               dup2(fd, which);
+               (void)dup2(fd, which);
                close(fd);
        }
 }