* use freopen() instead close()/open() : avoid potential fd leak

This commit is contained in:
hagen 2016-03-25 04:00:27 +00:00
parent 2e848a7c9a
commit 7bbe926232

View File

@ -64,12 +64,9 @@ namespace i2p
}
// close stdin/stdout/stderr descriptors
::close (0);
::open ("/dev/null", O_RDWR);
::close (1);
::open ("/dev/null", O_RDWR);
::close (2);
::open ("/dev/null", O_RDWR);
freopen("/dev/null", "r", stdin);
freopen("/dev/null", "w", stdout);
freopen("/dev/null", "w", stderr);
}
// Pidfile