diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-12-07 13:56:49 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-12-07 14:09:09 +0100 |
commit | 7630a1fe9a4c9a38b47fe385afb8d8a1902870d6 (patch) | |
tree | b633d7f6d22c4ff597c25abe9a6cd3cd887c94e5 /src | |
parent | 497d0e014cc79d46531d570e74e4aeae72db602d (diff) | |
parent | 529b8667599ad74f6dae639b889d22e907353070 (diff) |
Merge #11829: Test datadir specified in conf file exists
529b866 Test datadir in conf file exists (MeshCollider)
Pull request description:
Provoked by Nick ODell's discovery here: https://bitcoin.stackexchange.com/questions/64189/when-running-bitcoind-i-keep-getting-boostfilesystemspace-operation-not-p/64210#64210
If a custom data directory is specified using `-datadir` argument, its existence is checked before the conf file is loaded. But if the conf file then specifies a different non-existent `datadir`, that isn't tested, and results in esoteric errors like:
EXCEPTION: N5boost10filesystem16filesystem_errorE
boost::filesystem::space: Operation not permitted
This just adds a check for the datadir existence at the end of `ReadConfigFile()`
Tree-SHA512: e488618c40aa356263f94040ae00aa4be98038abef66e8674b01032d22a5553a7fafcb8fe2d1f095865b39fb138c07b7a94415a00ef837573f92f95af065f712
Diffstat (limited to 'src')
-rw-r--r-- | src/util.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp index 6631c236f1..1aa18c73b3 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -639,6 +639,9 @@ void ArgsManager::ReadConfigFile(const std::string& confPath) } // If datadir is changed in .conf file: ClearDatadirCache(); + if (!fs::is_directory(GetDataDir(false))) { + throw std::runtime_error(strprintf("specified data directory \"%s\" does not exist.", gArgs.GetArg("-datadir", "").c_str())); + } } #ifndef WIN32 |