From 173f88f08496b2b8e833a13d0122c00ec51421db Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 10 Dec 2024 14:02:40 +0000 Subject: Write the pid file earlier to avoid a crash. {fmt} gets angry if we try to write to a closed stdout. --- src/inspircd.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 0f568e1f4..a4bb478b0 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -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, -- cgit v1.3.1-10-gc9f91