]> git.proxmox.com Git - mirror_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>
Thu, 12 Jul 2018 15:52:09 +0000 (17:52 +0200)
Unchecked return value

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

index cfe5db26c945374895e112511cd5b719ae4fcbf3..1426eed5db84e06bf4b035155c6712cd046c9286 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);
        }
 }