]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Don't use logging in signal handler
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 7 Feb 2025 14:51:14 +0000 (15:51 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 10 Feb 2025 13:01:07 +0000 (14:01 +0100)
pdns/recursordist/rec_channel_rec.cc

index f40129beebc506c89fc3276eb5835be14cd5309a..bf0b64a5aff7aa75de513d03b147ac1d5e1eb2e7 100644 (file)
@@ -1378,7 +1378,10 @@ void doExitGeneric(bool nicely)
 #if defined(__SANITIZE_THREAD__)
   _exit(0); // regression test check for exit 0
 #endif
-  g_slog->withName("runtime")->info(Logr::Notice, "Exiting on user request");
+  // Not safe from a signal handler!
+  // g_slog->withName("runtime")->info(Logr::Notice, "Exiting on user request")
+  static const string msg("Exiting on user request\n");
+  (void)write(STDERR_FILENO, msg.data(), msg.size());
 
   if (!g_pidfname.empty()) {
     unlink(g_pidfname.c_str()); // we can at least try..