Use STD*_FILENO constants in Utility::Daemonize.

This commit is contained in:
Gunnar Beutner 2012-07-10 16:24:17 +02:00
parent 97b5c70eea
commit 6c03c495b5
1 changed files with 7 additions and 7 deletions

View File

@ -44,16 +44,16 @@ void Utility::Daemonize(void) {
if (fd < 0)
throw PosixException("open() failed", errno);
if (fd != 0)
dup2(fd, 0);
if (fd != STDIN_FILENO)
dup2(fd, STDIN_FILENO);
if (fd != 1)
dup2(fd, 1);
if (fd != STDOUT_FILENO)
dup2(fd, STDOUT_FILENO);
if (fd != 2)
dup2(fd, 2);
if (fd != STDERR_FILENO)
dup2(fd, STDERR_FILENO);
if (fd > 2)
if (fd > STDERR_FILENO)
close(fd);
if (setsid() < 0)