From: Otto Moerbeek Date: Fri, 7 Feb 2025 14:51:14 +0000 (+0100) Subject: Don't use logging in signal handler X-Git-Tag: dnsdist-2.0.0-alpha1~96^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05f5d1d0b3c07319079a1e3f0934eddb28434bfe;p=thirdparty%2Fpdns.git Don't use logging in signal handler --- diff --git a/pdns/recursordist/rec_channel_rec.cc b/pdns/recursordist/rec_channel_rec.cc index f40129beeb..bf0b64a5af 100644 --- a/pdns/recursordist/rec_channel_rec.cc +++ b/pdns/recursordist/rec_channel_rec.cc @@ -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..