In order to get the correct pid, we should daemonize before writing the pidfile
This commit is contained in:
parent
00da8bf7ba
commit
6b08f63fff
14
src/ndppd.cc
14
src/ndppd.cc
@ -201,13 +201,6 @@ int main(int argc, char* argv[], char* env[])
|
||||
}
|
||||
}
|
||||
|
||||
if (!pidfile.empty()) {
|
||||
std::ofstream pf;
|
||||
pf.open(pidfile.c_str(), std::ios::out | std::ios::trunc);
|
||||
pf << getpid() << std::endl;
|
||||
pf.close();
|
||||
}
|
||||
|
||||
logger::notice()
|
||||
<< "ndppd (NDP Proxy Daemon) version " NDPPD_VERSION << logger::endl
|
||||
<< "Using configuration file '" << config_path << "'";
|
||||
@ -226,6 +219,13 @@ int main(int argc, char* argv[], char* env[])
|
||||
}
|
||||
}
|
||||
|
||||
if (!pidfile.empty()) {
|
||||
std::ofstream pf;
|
||||
pf.open(pidfile.c_str(), std::ios::out | std::ios::trunc);
|
||||
pf << getpid() << std::endl;
|
||||
pf.close();
|
||||
}
|
||||
|
||||
// Time stuff.
|
||||
|
||||
struct timeval t1, t2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user