]> 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>
Mon, 22 Sep 2025 16:56:28 +0000 (18:56 +0200)
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;
       }