From: Otto Moerbeek Date: Mon, 22 Aug 2022 08:30:44 +0000 (+0200) Subject: rec_control: test for "--version" before requiring an argument. X-Git-Tag: rec-4.8.0-alpha1~45^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11867%2Fhead;p=thirdparty%2Fpdns.git rec_control: test for "--version" before requiring an argument. Fixes #11864 --- diff --git a/pdns/rec_control.cc b/pdns/rec_control.cc index 862ba00c14..2c81aafbad 100644 --- a/pdns/rec_control.cc +++ b/pdns/rec_control.cc @@ -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";