mirror of https://github.com/Icinga/icinga2.git
Fix how the stdin/stdout fds are set to null during Daemonize().
Fixes #5951 Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
This commit is contained in:
parent
2cfc0afc8a
commit
49d2932d30
|
@ -149,14 +149,14 @@ static bool Daemonize(const String& stderrFile)
|
|||
exit(0);
|
||||
|
||||
int fdnull = open("/dev/null", O_RDWR);
|
||||
if (fdnull > 0) {
|
||||
if (fdnull >= 0) {
|
||||
if (fdnull != 0)
|
||||
dup2(fdnull, 0);
|
||||
|
||||
if (fdnull != 1)
|
||||
dup2(fdnull, 1);
|
||||
|
||||
if (fdnull > 2)
|
||||
if (fdnull > 1)
|
||||
close(fdnull);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue