Write the pid file earlier to avoid a crash.

{fmt} gets angry if we try to write to a closed stdout.
This commit is contained in:
Sadie Powell 2024-12-10 14:02:40 +00:00
parent 16f2c1bde4
commit 173f88f084

View File

@ -504,6 +504,9 @@ InspIRCd::InspIRCd(int argc, char** argv)
Exit(EXIT_FAILURE);
}
// We only do this on boot because we might not be able to after dropping root.
WritePID();
// If we don't have a SID, generate one based on the server name and the server description
if (Config->ServerId.empty())
Config->ServerId = UIDGenerator::GenerateSID(Config->ServerName, Config->ServerDesc);
@ -591,7 +594,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
QueryPerformanceFrequency(&this->Stats.BootCPU);
#endif
WritePID();
DropRoot();
Logs.Normal("STARTUP", "Startup complete as '{}'[{}], {} max open sockets", Config->ServerName,