From e42df686f309c5cd08a8653207e79e9caae37b67 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 5 Jan 2013 00:13:29 +0100 Subject: [PATCH] Delete a left-over trash directory before doing a GC --- src/libstore/gc.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index a6b1a35e7..113a7da15 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). */