about summary refs log tree commit diff
path: root/src/libstore/gc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r--src/libstore/gc.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index e27c63de26ae..95c7154110b3 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -214,6 +214,18 @@ void removeTempRoots()
 }
 
 
+/* Automatically clean up the temporary roots file when we exit. */
+struct RemoveTempRoots 
+{
+    ~RemoveTempRoots()
+    {
+        removeTempRoots();
+    }
+};
+
+static RemoveTempRoots autoRemoveTempRoots __attribute__((unused));
+
+
 typedef boost::shared_ptr<AutoCloseFD> FDPtr;
 typedef list<FDPtr> FDs;