aboutsummaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-04-23 09:46:28 +0100
committerGravatar Sadie Powell2022-04-23 09:57:52 +0100
commitd682f3f2c962d4f6f986ade58cf3c1dc4adfbc67 (patch)
tree2a29ba1486a77571f564254a5be1c4dac45e8dbf /src/inspircd.cpp
parentMerge branch 'insp3' into master. (diff)
Only write to the pid file on boot.
Being able to change this after first boot is error prone and does not work well on system-wide installs where the server needs root to write the file. Closes #566.
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 9ea707d97..943de329b 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -418,7 +418,7 @@ void InspIRCd::Cleanup()
Logs.CloseLogs();
}
-void InspIRCd::WritePID(bool exitonfail)
+void InspIRCd::WritePID()
{
#ifndef _WIN32
if (!ServerInstance->Config->cmdline.writepid)
@@ -436,11 +436,9 @@ void InspIRCd::WritePID(bool exitonfail)
}
else
{
- if (exitonfail)
- std::cout << "Failed to write PID-file '" << pidfile << "', exiting." << std::endl;
- this->Logs.Log("STARTUP", LOG_DEFAULT, "Failed to write PID-file '%s'%s", pidfile.c_str(), (exitonfail ? ", exiting." : ""));
- if (exitonfail)
- Exit(EXIT_STATUS_PID);
+ std::cout << "Failed to write PID-file '" << pidfile << "', exiting." << std::endl;
+ this->Logs.Log("STARTUP", LOG_DEFAULT, "Failed to write PID-file '%s', exiting.", pidfile.c_str());
+ Exit(EXIT_STATUS_PID);
}
#endif
}
@@ -586,7 +584,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
QueryPerformanceFrequency(&stats.QPFrequency);
#endif
- WritePID(true);
+ WritePID();
DropRoot();
Logs.Log("STARTUP", LOG_DEFAULT, "Startup complete as '%s'[%s], %lu max open sockets", Config->ServerName.c_str(),Config->GetSID().c_str(), SocketEngine::GetMaxFds());