]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tools: return check (2) (Coverity 1143220)
authorpaco <paco@voltanet.io>
Wed, 20 Jun 2018 16:41:48 +0000 (18:41 +0200)
committerpaco <paco@voltanet.io>
Wed, 20 Jun 2018 19:26:38 +0000 (21:26 +0200)
Previous correction (657f9948ed593387d29d391832c18dc04326a5a9) was incomplete.

Signed-off-by: F. Aragon <paco@voltanet.io>
tools/start-stop-daemon.c

index 4758d2066668d677040efa13c0196ad41805ab94..ac0f76233c4744e5294077e358f2af3b006b346e 100644 (file)
@@ -1024,8 +1024,10 @@ int main(int argc, char **argv)
                        close(i);
                /* change tty */
                fd = open("/dev/tty", O_RDWR);
-               ioctl(fd, TIOCNOTTY, 0);
-               close(fd);
+               if (fd >= 0) {
+                       ioctl(fd, TIOCNOTTY, 0);
+                       close(fd);
+               }
                chdir("/");
                umask(022);    /* set a default for dumb programs */
                setpgid(0, 0); /* set the process group */