if we can't open /dev/null, you have much bigger issues to deal with
This commit is contained in:
parent
34c967707d
commit
e7107f616f
|
@ -341,18 +341,21 @@ static void daemonize(int *fds)
|
||||||
}
|
}
|
||||||
/* redirect std* to null */
|
/* redirect std* to null */
|
||||||
fd = open("/dev/null", O_RDONLY);
|
fd = open("/dev/null", O_RDONLY);
|
||||||
|
switch_assert( fd >= 0 );
|
||||||
if (fd != 0) {
|
if (fd != 0) {
|
||||||
dup2(fd, 0);
|
dup2(fd, 0);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open("/dev/null", O_WRONLY);
|
fd = open("/dev/null", O_WRONLY);
|
||||||
|
switch_assert( fd >= 0 );
|
||||||
if (fd != 1) {
|
if (fd != 1) {
|
||||||
dup2(fd, 1);
|
dup2(fd, 1);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open("/dev/null", O_WRONLY);
|
fd = open("/dev/null", O_WRONLY);
|
||||||
|
switch_assert( fd >= 0 );
|
||||||
if (fd != 2) {
|
if (fd != 2) {
|
||||||
dup2(fd, 2);
|
dup2(fd, 2);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
Loading…
Reference in New Issue