@@ -908,12 +908,12 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
908
908
}
909
909
if (use_conf_file) {
910
910
std::string chain_id = GetChainName ();
911
- std::vector<std::string> includeconf (GetArgs (" -includeconf" ));
911
+ std::vector<std::string> conf_file_names (GetArgs (" -includeconf" ));
912
912
{
913
913
// We haven't set m_network yet (that happens in SelectParams()), so manually check
914
914
// for network.includeconf args.
915
915
std::vector<std::string> includeconf_net (GetArgs (std::string (" -" ) + chain_id + " .includeconf" ));
916
- includeconf .insert (includeconf .end (), includeconf_net.begin (), includeconf_net.end ());
916
+ conf_file_names .insert (conf_file_names .end (), includeconf_net.begin (), includeconf_net.end ());
917
917
}
918
918
919
919
// Remove -includeconf from configuration, so we can warn about recursion
@@ -924,33 +924,33 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
924
924
m_config_args.erase (std::string (" -" ) + chain_id + " .includeconf" );
925
925
}
926
926
927
- for (const std::string& to_include : includeconf ) {
928
- fsbridge::ifstream include_config (GetConfigFile (to_include ));
929
- if (include_config .good ()) {
930
- if (!ReadConfigStream (include_config, to_include , error, ignore_invalid_keys)) {
927
+ for (const std::string& conf_file_name : conf_file_names ) {
928
+ fsbridge::ifstream conf_file_stream (GetConfigFile (conf_file_name ));
929
+ if (conf_file_stream .good ()) {
930
+ if (!ReadConfigStream (conf_file_stream, conf_file_name , error, ignore_invalid_keys)) {
931
931
return false ;
932
932
}
933
- LogPrintf (" Included configuration file %s\n " , to_include );
933
+ LogPrintf (" Included configuration file %s\n " , conf_file_name );
934
934
} else {
935
- error = " Failed to include configuration file " + to_include ;
935
+ error = " Failed to include configuration file " + conf_file_name ;
936
936
return false ;
937
937
}
938
938
}
939
939
940
940
// Warn about recursive -includeconf
941
- includeconf = GetArgs (" -includeconf" );
941
+ conf_file_names = GetArgs (" -includeconf" );
942
942
{
943
943
std::vector<std::string> includeconf_net (GetArgs (std::string (" -" ) + chain_id + " .includeconf" ));
944
- includeconf .insert (includeconf .end (), includeconf_net.begin (), includeconf_net.end ());
944
+ conf_file_names .insert (conf_file_names .end (), includeconf_net.begin (), includeconf_net.end ());
945
945
std::string chain_id_final = GetChainName ();
946
946
if (chain_id_final != chain_id) {
947
947
// Also warn about recursive includeconf for the chain that was specified in one of the includeconfs
948
948
includeconf_net = GetArgs (std::string (" -" ) + chain_id_final + " .includeconf" );
949
- includeconf .insert (includeconf .end (), includeconf_net.begin (), includeconf_net.end ());
949
+ conf_file_names .insert (conf_file_names .end (), includeconf_net.begin (), includeconf_net.end ());
950
950
}
951
951
}
952
- for (const std::string& to_include : includeconf ) {
953
- tfm::format (std::cerr, " warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n " , to_include );
952
+ for (const std::string& conf_file_name : conf_file_names ) {
953
+ tfm::format (std::cerr, " warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n " , conf_file_name );
954
954
}
955
955
}
956
956
}
0 commit comments