diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-03-22 14:57:46 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-03-22 15:14:43 +0100 |
commit | c290508a5ebf7e26c68fc0bb01382f708e645402 (patch) | |
tree | eccce3982fbcb825bbaff535551045bf1c2c6f7f /src/init.cpp | |
parent | a6926b065d654a448937f9f1e2999ac48d50a984 (diff) | |
parent | 8674e74b47c1f6e86a367cfbc738fcc9812b616b (diff) | |
download | bitcoin-c290508a5ebf7e26c68fc0bb01382f708e645402.tar.xz |
Merge #12630: Provide useful error message if datadir is not writable.
8674e74 Provide relevant error message if datadir is not writable. (murrayn)
Pull request description:
If the --datadir exists, but is not writable, the current error message on startup is 'Cannot obtain a lock on data directory foo. Bitcoin Core is probably already running.' This is misleading.
I believe this PR addresses #11668, although the issue is not Windows-specific.
Tree-SHA512: 10cbbaea433072aee4fb3e8938a72073c7a5c841f7a7685c9e12549c322b2925c7d34bac254ac33021b23132bfc352c058712bc9542298cf86f8fd9757f528b2
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp index e0efe5c0a2..30ee0e694c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1165,6 +1165,9 @@ static bool LockDataDirectory(bool probeOnly) { // Make sure only a single Bitcoin process is using the data directory. fs::path datadir = GetDataDir(); + if (!DirIsWritable(datadir)) { + return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), datadir.string())); + } if (!LockDirectory(datadir, ".lock", probeOnly)) { return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), datadir.string(), _(PACKAGE_NAME))); } |