]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Don't fail on ENOENT when trying to break a LockFile lock
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 15 Sep 2025 19:39:18 +0000 (21:39 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 1 Oct 2025 18:12:27 +0000 (20:12 +0200)
(cherry picked from commit e6f7b72c7f575cddba4cb86d7e4175b1d3e4bf10)

src/ccache/util/lockfile.cpp

index 8eac5a3c60b9a6e280d95a9d1677d39fee5a1d85..87e338afbf7911a078edaa2f0e25b837d06c2a86 100644 (file)
@@ -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;
       }