aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authormurrayn <github@nesbitt.ca>2018-03-07 03:08:55 -0800
committermurrayn <github@nesbitt.ca>2018-03-14 19:07:30 -0700
commit8674e74b47c1f6e86a367cfbc738fcc9812b616b (patch)
treeacf9d52938e2021e4dcb9ad1c89e02ae8362d82a /src/init.cpp
parentb225010a808d475cbb53aeed484295f8dc8751c4 (diff)
Provide relevant error message if datadir is not writable.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index f763c3a435..6493ae72bd 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)));
}