summary refs log tree commit diff
path: root/nix/libstore/gc.cc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-10-17 09:36:43 +0200
committerLudovic Courtès <ludo@gnu.org>2022-10-17 09:37:27 +0200
commiteec920ba93ecb086366576e31b785962fbaf81c2 (patch)
tree62191756374c666f323d749e2be6111271600a5f /nix/libstore/gc.cc
parent094b357783ae92fc5652f8a8c61e0b96b342d09d (diff)
downloadguix-eec920ba93ecb086366576e31b785962fbaf81c2.tar.gz
Revert "nix: Guard against removing temporary roots of living processes."
This reverts commit bb0beaecdee1a2315a1269b1746d238c8ab0e699.  This
change broke a number of tests that assumed the previous behavior.
Diffstat (limited to 'nix/libstore/gc.cc')
-rw-r--r--nix/libstore/gc.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index f101de92d6..16519116e4 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -2,7 +2,6 @@
 #include "misc.hh"
 #include "local-store.hh"
 
-#include <string>
 #include <functional>
 #include <queue>
 #include <algorithm>
@@ -227,10 +226,10 @@ static void readTempRoots(PathSet & tempRoots, FDs & fds)
         //FDPtr fd(new AutoCloseFD(openLockFile(path, false)));
         //if (*fd == -1) continue;
 
-        /* Try to acquire a write lock without blocking.  This can only
-           succeed if the owning process has died, in which case we don't care
-           about its temporary roots, or if we are the owning process.  */
-        if (i.name != std::to_string(getpid()) && lockFile(*fd, ltWrite, false)) {
+        /* Try to acquire a write lock without blocking.  This can
+           only succeed if the owning process has died.  In that case
+           we don't care about its temporary roots. */
+        if (lockFile(*fd, ltWrite, false)) {
             printMsg(lvlError, format("removing stale temporary roots file `%1%'") % path);
             unlink(path.c_str());
             writeFull(*fd, "d");