From 2e21fc179056be8fa45b9d87b59ae37fa4eb44fc Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 22 Aug 2022 10:30:44 +0200 Subject: [PATCH] rec_control: test for "--version" before requiring an argument. Fixes #11864 --- pdns/rec_control.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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"; -- 2.47.2