]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
recursor: Don't parse any config with `--version` 9569/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 1 Oct 2020 11:47:27 +0000 (13:47 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 1 Oct 2020 11:47:27 +0000 (13:47 +0200)
This ensures we don't log anything _apart_ from the version info.
Spotted in https://github.com/PowerDNS/pdns_recursor-ansible/issues/66

pdns/pdns_recursor.cc

index 05386e527303f6f10da4e1bd86355ac9de8329d8..dd886b048fbd0f5342e8818a3a027820c5eb7a22 100644 (file)
@@ -5200,6 +5200,12 @@ int main(int argc, char **argv)
     g_log.toConsole(Logger::Info);
     ::arg().laxParse(argc,argv); // do a lax parse
 
+    if(::arg().mustDo("version")) {
+      showProductVersion();
+      showBuildConfiguration();
+      exit(0);
+    }
+
     string configname=::arg()["config-dir"]+"/recursor.conf";
     if(::arg()["config-name"]!="") {
       configname=::arg()["config-dir"]+"/recursor-"+::arg()["config-name"]+".conf";
@@ -5270,12 +5276,6 @@ int main(int argc, char **argv)
       cout<<::arg().helpstring(::arg()["help"])<<endl;
       exit(0);
     }
-    if(::arg().mustDo("version")) {
-      showProductVersion();
-      showBuildConfiguration();
-      exit(0);
-    }
-
     g_recCache = std::unique_ptr<MemRecursorCache>(new MemRecursorCache(::arg().asNum("record-cache-shards")));
     g_negCache = std::unique_ptr<NegCache>(new NegCache(::arg().asNum("record-cache-shards")));