summary refs log tree commit diff
path: root/nix/libstore/gc.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-03 22:37:51 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-11 17:36:05 +0200
commitc2b65dd197a1b2e14d517b0b5ff307b149538917 (patch)
tree293b6f9039079d488bb28bd220baf4b0ca7aae26 /nix/libstore/gc.cc
parentc95742283595cb01b44ddc8e6ff5e9c1d66db444 (diff)
downloadguix-c2b65dd197a1b2e14d517b0b5ff307b149538917.tar.gz
Remove some duplicate code
Diffstat (limited to 'nix/libstore/gc.cc')
-rw-r--r--nix/libstore/gc.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index 4babea4a50..05d332f2a1 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -301,12 +301,8 @@ static void findRoots(StoreAPI & store, const Path & path, unsigned char type, R
 {
     try {
 
-        if (type == DT_UNKNOWN) {
-            struct stat st = lstat(path);
-            if (S_ISDIR(st.st_mode)) type = DT_DIR;
-            else if (S_ISLNK(st.st_mode)) type = DT_LNK;
-            else if (S_ISREG(st.st_mode)) type = DT_REG;
-        }
+        if (type == DT_UNKNOWN)
+            type = getFileType(path);
 
         if (type == DT_DIR) {
             for (auto & i : readDirectory(path))