diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-07-17 17:12:00 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-07-17 17:13:11 +0200 |
commit | 89bb0365b97af7a6f46b010ceb9ff31627a8f9db (patch) | |
tree | 55e3db7b60363ffb039988a1e6d312cd246ab274 /src/bitcoind.cpp | |
parent | 2b0179d8a9b75397937126b36114df0dddeab40c (diff) | |
parent | dba485d65168794d8be39bd5e8de8777e7085434 (diff) |
Merge #10832: init: Factor out AppInitLockDataDirectory and fix startup core dump issue
dba485d init: Factor out AppInitLockDataDirectory (Wladimir J. van der Laan)
Pull request description:
Alternative to #10818, alternative solution to #10815.
After this change: All the AppInit steps before and inclusive AppInitLockDataDirectory must not have Shutdown() called in case of failure. Only when AppInitMain fails, Shutdown should be called.
Changes the GUI and bitcoind code to consistently do this.
Tree-SHA512: 393e1a0ae05eb8e791025069e3ac4f6f3cdeb459ec63feda85d01cf6696ab3fed7632b6a0ac3641b8c7015af51d46756b5bba77f5e5f0c446f0c2dea58bbc92e
Diffstat (limited to 'src/bitcoind.cpp')
-rw-r--r-- | src/bitcoind.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 374678310c..f3844e9d47 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -159,7 +159,12 @@ bool AppInit(int argc, char* argv[]) return false; #endif // HAVE_DECL_DAEMON } - + // Lock data directory after daemonization + if (!AppInitLockDataDirectory()) + { + // If locking the data directory failed, exit immediately + exit(EXIT_FAILURE); + } fRet = AppInitMain(threadGroup, scheduler); } catch (const std::exception& e) { |