]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Respect RUNTIME_DIRECTORY as a default for socket-dir
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 8 Dec 2023 08:37:08 +0000 (09:37 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 8 Dec 2023 08:37:08 +0000 (09:37 +0100)
This was lost with the conversion to the new settings.

pdns/recursordist/rec-main.cc

index 0e64433b662fcf3ec1f36d9c45acfec862ec0217..5a6f7159227efa96345349630cb591a157627810 100644 (file)
@@ -2941,6 +2941,13 @@ static void handleRuntimeDefaults(Logr::log_t log)
     ::arg().set("server-id") = myHostname.has_value() ? *myHostname : "";
   }
 
+  if (::arg()["socket-dir"].empty()) {
+    auto* runtimeDir = getenv("RUNTIME_DIRECTORY"); // NOLINT(concurrency-mt-unsafe,cppcoreguidelines-pro-type-vararg)
+    if (runtimeDir != nullptr) {
+      ::arg().set("socket-dir") = runtimeDir;
+    }
+  }
+
   if (::arg()["socket-dir"].empty()) {
     if (::arg()["chroot"].empty()) {
       ::arg().set("socket-dir") = std::string(LOCALSTATEDIR) + "/pdns-recursor";