File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -790,6 +790,14 @@ void ArgsManager::ReadConfigFiles()
790790 includeconf.insert (includeconf.end (), includeconf_net.begin (), includeconf_net.end ());
791791 }
792792
793+ // Remove -includeconf from configuration, so we can warn about recursion
794+ // later
795+ {
796+ LOCK (cs_args);
797+ m_config_args.erase (" -includeconf" );
798+ m_config_args.erase (std::string (" -" ) + GetChainName () + " .includeconf" );
799+ }
800+
793801 for (const std::string& to_include : includeconf) {
794802 fs::ifstream include_config (GetConfigFile (to_include));
795803 if (include_config.good ()) {
@@ -799,6 +807,16 @@ void ArgsManager::ReadConfigFiles()
799807 fprintf (stderr, " Failed to include configuration file %s\n " , to_include.c_str ());
800808 }
801809 }
810+
811+ // Warn about recursive -includeconf
812+ includeconf = GetArgs (" -includeconf" );
813+ {
814+ std::vector<std::string> includeconf_net (GetArgs (std::string (" -" ) + GetChainName () + " .includeconf" ));
815+ includeconf.insert (includeconf.end (), includeconf_net.begin (), includeconf_net.end ());
816+ }
817+ for (const std::string& to_include : includeconf) {
818+ fprintf (stderr, " warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n " , to_include.c_str ());
819+ }
802820 }
803821 }
804822
You can’t perform that action at this time.
0 commit comments