mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-24 20:57:37 +01:00
remove to call C functions and use C++ std::fstream
- Point std{in,out,err} descriptors to /dev/null (C++ wey)
This commit is contained in:
parent
9980df2c67
commit
3ff9b2a5d3
1 changed files with 5 additions and 5 deletions
|
@ -74,13 +74,13 @@ namespace i2p
|
|||
LogPrint(eLogError, "Daemon: could not chdir: ", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
// point std{in,out,err} descriptors to /dev/null
|
||||
stdin = freopen("/dev/null", "r", stdin);
|
||||
stdout = freopen("/dev/null", "w", stdout);
|
||||
stderr = freopen("/dev/null", "w", stderr);
|
||||
}
|
||||
|
||||
std::ofstream fout("/dev/null");
|
||||
std::cout.rdbuf(fout.rdbuf());
|
||||
std::cerr.rdbuf(fout.rdbuf());
|
||||
std::cin.rdbuf(fout.rdbuf());
|
||||
|
||||
// Pidfile
|
||||
// this code is c-styled and a bit ugly, but we need fd for locking pidfile
|
||||
std::string pidfile; i2p::config::GetOption("pidfile", pidfile);
|
||||
|
|
Loading…
Add table
Reference in a new issue