Merge pull request #5 from szatam/master

In order to get the correct pid, we should daemonize before writing the ...
This commit is contained in:
Daniel Adolfsson 2015-01-28 16:45:48 +04:00
commit e2e44ec5ed

View File

@ -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() logger::notice()
<< "ndppd (NDP Proxy Daemon) version " NDPPD_VERSION << logger::endl << "ndppd (NDP Proxy Daemon) version " NDPPD_VERSION << logger::endl
<< "Using configuration file '" << config_path << "'"; << "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. // Time stuff.
struct timeval t1, t2; struct timeval t1, t2;