]> git.puffer.fish Git - mirror/frr.git/commitdiff
tools: return check (Coverity 1143220) 2436/head
authorpaco <paco@voltanet.io>
Wed, 13 Jun 2018 16:07:36 +0000 (18:07 +0200)
committerpaco <paco@voltanet.io>
Wed, 13 Jun 2018 16:07:36 +0000 (18:07 +0200)
Signed-off-by: F. Aragon <paco@voltanet.io>
tools/start-stop-daemon.c

index 6bf55b77405661decbe488af5c3006f4ac705b1a..4758d2066668d677040efa13c0196ad41805ab94 100644 (file)
@@ -1030,8 +1030,10 @@ int main(int argc, char **argv)
                umask(022);    /* set a default for dumb programs */
                setpgid(0, 0); /* set the process group */
                fd = open("/dev/null", O_RDWR); /* stdin */
-               dup(fd);                        /* stdout */
-               dup(fd);                        /* stderr */
+               if (fd >= 0) {
+                       dup(fd);                /* stdout */
+                       dup(fd);                /* stderr */
+               }
        }
        if (nicelevel) {
                errno = 0;