about summary refs log tree commit diff
path: root/src/libstore/gc.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-03T20·37+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-03T20·37+0200
commit3f8576a6abedfa7c16d6f13dbdbabaa695cf60bb (patch)
treee1aad65d6748f23229b06768d61c21401de2a98f /src/libstore/gc.cc
parentc08c802bf31ce739e0de6d1fbfe4d58b808ae9bb (diff)
Remove some duplicate code
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r--src/libstore/gc.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 481f5a7c35a8..e9db711e7ca0 100644
--- a/src/libstore/gc.cc
+++ b/src/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))