aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2023-04-25 11:19:38 -0400
committerluigi1111 <luigi1111w@gmail.com>2023-04-25 11:19:38 -0400
commit83100b6cbef0f1eefff2118cb44012e0a023d897 (patch)
treeab282c583a2a9d4dbae4c9c79af6e54782c7d924
parentMerge pull request #8750 (diff)
parentHandle case where a command line flag is not allowed in the config file (diff)
downloadmonero-83100b6cbef0f1eefff2118cb44012e0a023d897.tar.xz
Merge pull request #8764
b13ddb9 Handle case where a command line flag is not allowed in the config file (almalh)
-rw-r--r--src/daemon/main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index 7082c2833..23c313c9d 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -219,6 +219,19 @@ int main(int argc, char const * argv[])
{
po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm);
}
+ catch (const po::unknown_option &e)
+ {
+ std::string unrecognized_option = e.get_option_name();
+ if (all_options.find_nothrow(unrecognized_option, false))
+ {
+ std::cerr << "Option '" << unrecognized_option << "' is not allowed in the config file, please use it as a command line flag." << std::endl;
+ }
+ else
+ {
+ std::cerr << "Unrecognized option '" << unrecognized_option << "' in config file." << std::endl;
+ }
+ return 1;
+ }
catch (const std::exception &e)
{
// log system isn't initialized yet