mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
util: Check if specified config file cannot be opened
This commit is contained in:
parent
eaf09bda4a
commit
6bb54708e6
1 changed files with 5 additions and 0 deletions
|
@ -904,6 +904,11 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
|
||||||
const std::string confPath = GetArg("-conf", BITCOIN_CONF_FILENAME);
|
const std::string confPath = GetArg("-conf", BITCOIN_CONF_FILENAME);
|
||||||
fsbridge::ifstream stream(GetConfigFile(confPath));
|
fsbridge::ifstream stream(GetConfigFile(confPath));
|
||||||
|
|
||||||
|
// not ok to have a config file specified that cannot be opened
|
||||||
|
if (IsArgSet("-conf") && !stream.good()) {
|
||||||
|
error = strprintf("specified config file \"%s\" could not be opened.", confPath);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// ok to not have a config file
|
// ok to not have a config file
|
||||||
if (stream.good()) {
|
if (stream.good()) {
|
||||||
if (!ReadConfigStream(stream, confPath, error, ignore_invalid_keys)) {
|
if (!ReadConfigStream(stream, confPath, error, ignore_invalid_keys)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue