summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-01-05 00:13:29 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-01-05 00:13:29 +0100
commite42df686f309c5cd08a8653207e79e9caae37b67 (patch)
treeff891fbc189d2aef7d099d0f675f96f4e72f060b /src
parent92926be2fe15b25759e8e3e129a093798f8c37b6 (diff)
downloadguix-e42df686f309c5cd08a8653207e79e9caae37b67.tar.gz
Delete a left-over trash directory before doing a GC
Diffstat (limited to 'src')
-rw-r--r--src/libstore/gc.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index a6b1a35e77..113a7da154 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -659,7 +659,10 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
        increase, since we hold locks on everything.  So everything
        that is not reachable from `roots'. */
 
-    if (state.shouldDelete) createDirs(state.trashDir);
+    if (state.shouldDelete) {
+        if (pathExists(state.trashDir)) deleteGarbage(state, state.trashDir);
+        createDirs(state.trashDir);
+    }
 
     /* Now either delete all garbage paths, or just the specified
        paths (for gcDeleteSpecific). */