From: Otto Moerbeek Date: Wed, 1 Jun 2022 08:46:19 +0000 (+0200) Subject: Modify journal availability test. X-Git-Tag: auth-4.8.0-alpha0~68^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d430b4902b06c8fa9d9855319145245f1ef17f6;p=thirdparty%2Fpdns.git Modify journal availability test. To both test for NOTIFY_SOCKET (to see if we're runnign underst systemd) and availbility of the journal socket (to see if systemd-journal is active) --- diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 9282c89278..dfd16a7617 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -2762,11 +2762,13 @@ int main(int argc, char** argv) #ifdef HAVE_SYSTEMD if (getenv("NOTIFY_SOCKET") != nullptr) { - g_slog = Logging::Logger::create(loggerSDBackend); + if (int fd = sd_journal_stream_fd("pdns-recusor", LOG_DEBUG, 0); fd >= 0) { + g_slog = Logging::Logger::create(loggerSDBackend); + close(fd); + } } - else #endif - { + if (g_slog == nullptr) { g_slog = Logging::Logger::create(loggerBackend); } // Missing: a mechanism to call setVerbosity(x)