mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Return LockResult::ErrorWrite in LockDirectory
This allows the caller to remove a call to DirIsWritable(), which did a similar check. Users should not notice any different behavior.
This commit is contained in:
@@ -1028,10 +1028,9 @@ static bool LockDataDirectory(bool probeOnly)
|
||||
{
|
||||
// Make sure only a single Bitcoin process is using the data directory.
|
||||
const fs::path& datadir = gArgs.GetDataDirNet();
|
||||
if (!DirIsWritable(datadir)) {
|
||||
return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), fs::PathToString(datadir)));
|
||||
}
|
||||
switch (util::LockDirectory(datadir, ".lock", probeOnly)) {
|
||||
case util::LockResult::ErrorWrite:
|
||||
return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), fs::PathToString(datadir)));
|
||||
case util::LockResult::ErrorLock:
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), fs::PathToString(datadir), PACKAGE_NAME));
|
||||
case util::LockResult::Success: return true;
|
||||
|
||||
Reference in New Issue
Block a user