]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec_control: test for "--version" before requiring an argument. 11867/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 22 Aug 2022 08:30:44 +0000 (10:30 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 22 Aug 2022 08:30:44 +0000 (10:30 +0200)
Fixes #11864

pdns/rec_control.cc

index 862ba00c14477071c7e841fe290a7f3f1e4260df..2c81aafbad6d9caf30824e8eb57c9ef5c85dfc39 100644 (file)
@@ -51,6 +51,10 @@ static void initArguments(int argc, char** argv)
   arg().setCmd("version", "Show the version of this program");
 
   arg().laxParse(argc, argv);
+  if (arg().mustDo("version")) {
+    cout << "rec_control version " << VERSION << endl;
+    exit(0);
+  }
   if (arg().mustDo("help") || arg().getCommands().empty()) {
     cout << "syntax: rec_control [options] command, options as below: " << endl
          << endl;
@@ -59,11 +63,6 @@ static void initArguments(int argc, char** argv)
     exit(arg().mustDo("help") ? 0 : 99);
   }
 
-  if (arg().mustDo("version")) {
-    cout << "rec_control version " << VERSION << endl;
-    exit(0);
-  }
-
   string configname = ::arg()["config-dir"] + "/recursor.conf";
   if (::arg()["config-name"] != "")
     configname = ::arg()["config-dir"] + "/recursor-" + ::arg()["config-name"] + ".conf";