From e7107f616fe12f54f3bea4007af07509c0156d5f Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 28 Apr 2014 16:02:39 -0400 Subject: [PATCH] if we can't open /dev/null, you have much bigger issues to deal with --- src/switch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/switch.c b/src/switch.c index d5bc66ab9c..e76bd8d913 100644 --- a/src/switch.c +++ b/src/switch.c @@ -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);