ReadConfigStream: assume the stream is good
This commit is contained in:
parent
6d5815aad0
commit
087c5d2040
1 changed files with 17 additions and 17 deletions
34
src/util.cpp
34
src/util.cpp
|
@ -737,31 +737,31 @@ fs::path GetConfigFile(const std::string& confPath)
|
||||||
|
|
||||||
void ArgsManager::ReadConfigStream(std::istream& stream)
|
void ArgsManager::ReadConfigStream(std::istream& stream)
|
||||||
{
|
{
|
||||||
if (!stream.good())
|
LOCK(cs_args);
|
||||||
return; // No bitcoin.conf file is OK
|
|
||||||
|
|
||||||
|
std::set<std::string> setOptions;
|
||||||
|
setOptions.insert("*");
|
||||||
|
|
||||||
|
for (boost::program_options::detail::config_file_iterator it(stream, setOptions), end; it != end; ++it)
|
||||||
{
|
{
|
||||||
LOCK(cs_args);
|
// Don't overwrite existing settings so command line settings override bitcoin.conf
|
||||||
std::set<std::string> setOptions;
|
std::string strKey = std::string("-") + it->string_key;
|
||||||
setOptions.insert("*");
|
std::string strValue = it->value[0];
|
||||||
|
InterpretNegatedOption(strKey, strValue);
|
||||||
for (boost::program_options::detail::config_file_iterator it(stream, setOptions), end; it != end; ++it)
|
if (mapArgs.count(strKey) == 0)
|
||||||
{
|
mapArgs[strKey] = strValue;
|
||||||
// Don't overwrite existing settings so command line settings override bitcoin.conf
|
mapMultiArgs[strKey].push_back(strValue);
|
||||||
std::string strKey = std::string("-") + it->string_key;
|
|
||||||
std::string strValue = it->value[0];
|
|
||||||
InterpretNegatedOption(strKey, strValue);
|
|
||||||
if (mapArgs.count(strKey) == 0)
|
|
||||||
mapArgs[strKey] = strValue;
|
|
||||||
mapMultiArgs[strKey].push_back(strValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArgsManager::ReadConfigFile(const std::string& confPath)
|
void ArgsManager::ReadConfigFile(const std::string& confPath)
|
||||||
{
|
{
|
||||||
fs::ifstream stream(GetConfigFile(confPath));
|
fs::ifstream stream(GetConfigFile(confPath));
|
||||||
ReadConfigStream(stream);
|
|
||||||
|
// ok to not have a config file
|
||||||
|
if (stream.good()) {
|
||||||
|
ReadConfigStream(stream);
|
||||||
|
}
|
||||||
|
|
||||||
// If datadir is changed in .conf file:
|
// If datadir is changed in .conf file:
|
||||||
ClearDatadirCache();
|
ClearDatadirCache();
|
||||||
|
|
Loading…
Reference in a new issue