From 6c03c495b590e3d19b8c95e6256e8e4c26e141fd Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 10 Jul 2012 16:24:17 +0200 Subject: [PATCH] Use STD*_FILENO constants in Utility::Daemonize. --- base/utility.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/base/utility.cpp b/base/utility.cpp index ece0c12c7..2a078d77f 100644 --- a/base/utility.cpp +++ b/base/utility.cpp @@ -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)