From a75efd417098dada0c4170a27a1bf76f7f55b26e Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Sun, 17 Jul 2011 18:52:23 -0400 Subject: Only write pidfile if we have parsed a valid configuration --- src/configreader.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/configreader.cpp b/src/configreader.cpp index f02c5bdbb..6ef5105aa 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -657,12 +657,13 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) errstr << ce.GetReason(); } - // write once here, to try it out and make sure its ok - ServerInstance->WritePID(this->PID); - // Check errors before dealing with failed binds, since continuing on failed bind is wanted in some circumstances. valid = errstr.str().empty(); + // write once here, to try it out and make sure its ok + if (valid) + ServerInstance->WritePID(this->PID); + if (old) { // On first run, ports are bound later on -- cgit v1.2.3