Skip to content

Commit 64f7ad0

Browse files
authored
Merge pull request #2400 from barton2526/conf-file
util: Check if specified config file cannot be opened
2 parents 793a65b + 4ffde40 commit 64f7ad0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/util/system.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,12 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
901901

902902
fsbridge::ifstream stream(config_file_spec);
903903

904+
// not ok to have a config file specified that cannot be opened
905+
if (IsArgSet("-conf") && !stream.good()) {
906+
error = strprintf("specified config file \"%s\" could not be opened.", confPath);
907+
return false;
908+
}
909+
904910
// ok to not have a config file
905911
if (stream.good()) {
906912
if (!ReadConfigStream(stream, confPath, error, ignore_invalid_keys)) {

0 commit comments

Comments
 (0)