about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/nix-collect-garbage/nix-collect-garbage.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc
index ae75fd62103c..d8ddf9ec4c4c 100644
--- a/src/nix-collect-garbage/nix-collect-garbage.cc
+++ b/src/nix-collect-garbage/nix-collect-garbage.cc
@@ -38,7 +38,7 @@ void removeOldGenerations(std::string dir)
         checkInterrupt();
 
         auto path = dir + "/" + i.name; 
-        auto type = getFileType(path);
+        auto type = i.type == DT_UNKNOWN ? getFileType(path) : i.type;
 
         if (type == DT_LNK) {
             auto link = readLink(path);