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
} }
// close stdin/stdout/stderr descriptors // close stdin/stdout/stderr descriptors
::close (0); freopen("/dev/null", "r", stdin);
::open ("/dev/null", O_RDWR); freopen("/dev/null", "w", stdout);
::close (1); freopen("/dev/null", "w", stderr);
::open ("/dev/null", O_RDWR);
::close (2);
::open ("/dev/null", O_RDWR);
} }
// Pidfile // Pidfile

Loading…
Cancel
Save