From: Joel Rosdahl Date: Mon, 15 Sep 2025 19:39:18 +0000 (+0200) Subject: fix: Don't fail on ENOENT when trying to break a LockFile lock X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6f7b72c7f575cddba4cb86d7e4175b1d3e4bf10;p=thirdparty%2Fccache.git fix: Don't fail on ENOENT when trying to break a LockFile lock --- diff --git a/src/ccache/util/lockfile.cpp b/src/ccache/util/lockfile.cpp index 8eac5a3c..87e338af 100644 --- a/src/ccache/util/lockfile.cpp +++ b/src/ccache/util/lockfile.cpp @@ -339,7 +339,12 @@ LockFile::do_acquire(const bool blocking) m_lock_file, inactive_duration.sec(), inactive_duration.nsec_decimal_part() / 1'000'000); - if (!fs::remove(m_alive_file) || !fs::remove(m_lock_file)) { + if (auto r = fs::remove(m_alive_file); + !r && r.error() != std::errc::no_such_file_or_directory) { + return false; + } + if (auto r = fs::remove(m_lock_file); + !r && r.error() != std::errc::no_such_file_or_directory) { return false; }