Skip to content

Commit

Permalink
Merge bitcoin#11829: Test datadir specified in conf file exists
Browse files Browse the repository at this point in the history
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
  • Loading branch information
laanwj authored and PastaPastaPasta committed Jan 31, 2020
1 parent 0fee42e commit 1a754b5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,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
Expand Down

0 comments on commit 1a754b5

Please sign in to comment.