Browse Source

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

pull/443/head
hagen 9 years ago
parent
commit
7bbe926232
  1. 9
      DaemonLinux.cpp

9
DaemonLinux.cpp

@ -64,12 +64,9 @@ namespace i2p @@ -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

Loading…
Cancel
Save