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.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index e1e7b4c1c5..e27c63de26 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -40,6 +40,7 @@ int LocalStore::openGCLock(LockType lockType)
     AutoCloseFD fdGCLock = open(fnGCLock.c_str(), O_RDWR | O_CREAT, 0600);
     if (fdGCLock == -1)
         throw SysError(format("opening global GC lock `%1%'") % fnGCLock);
+    closeOnExec(fdGCLock);
 
     if (!lockFile(fdGCLock, lockType, false)) {
         printMsg(lvlError, format("waiting for the big garbage collector lock..."));