]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
if we can't open /dev/null, you have much bigger issues to deal with
authorMichael Jerris <mike@jerris.com>
Mon, 28 Apr 2014 20:02:39 +0000 (16:02 -0400)
committerMichael Jerris <mike@jerris.com>
Mon, 28 Apr 2014 20:02:39 +0000 (16:02 -0400)
src/switch.c

index d5bc66ab9c345cc50943a6c27054be36af8aef9d..e76bd8d913fdbe4f49c94d4eb2ae1d473d569852 100644 (file)
@@ -341,18 +341,21 @@ static void daemonize(int *fds)
        }
        /* redirect std* to null */
        fd = open("/dev/null", O_RDONLY);
+       switch_assert( fd >= 0 );
        if (fd != 0) {
                dup2(fd, 0);
                close(fd);
        }
 
        fd = open("/dev/null", O_WRONLY);
+       switch_assert( fd >= 0 );
        if (fd != 1) {
                dup2(fd, 1);
                close(fd);
        }
 
        fd = open("/dev/null", O_WRONLY);
+       switch_assert( fd >= 0 );
        if (fd != 2) {
                dup2(fd, 2);
                close(fd);