提交 e7107f61 authored 作者: Michael Jerris's avatar Michael Jerris

if we can't open /dev/null, you have much bigger issues to deal with

上级 34c96770
......@@ -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);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论