From bdc0a68e676f237bcbb5195a60bb08bb34123e71 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Wed, 15 Jan 2025 19:11:33 +0000 Subject: [PATCH] init: lock blocksdir in addition to datadir This guards against 2 processes running with separate datadirs but the same blocksdir. It's not likely to happen currently, but may be more relevant in the future with applications using the kernel. Note that the kernel does not currently do any dir locking, but it should. --- src/init.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 13ef7ee13e4..002f570e983 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1086,7 +1086,8 @@ static bool LockDirectory(const fs::path& dir, bool probeOnly) } static bool LockDirectories(bool probeOnly) { - return LockDirectory(gArgs.GetDataDirNet(), probeOnly); + return LockDirectory(gArgs.GetDataDirNet(), probeOnly) && \ + LockDirectory(gArgs.GetBlocksDirPath(), probeOnly); } bool AppInitSanityChecks(const kernel::Context& kernel)