aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoind.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-07-15 10:46:06 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-07-17 14:56:52 +0200
commitdba485d65168794d8be39bd5e8de8777e7085434 (patch)
tree8d5436757050d19f9cfe850ec968c83ac664f62a /src/bitcoind.cpp
parent8fdd23a224ba236874ef662c4ca311b002dbcab3 (diff)
downloadbitcoin-dba485d65168794d8be39bd5e8de8777e7085434.tar.xz
init: Factor out AppInitLockDataDirectory
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.
Diffstat (limited to 'src/bitcoind.cpp')
-rw-r--r--src/bitcoind.cpp7
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) {