aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-06-14 08:34:48 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-06-14 08:34:48 +0000
commitb57189174f6e11c3e9e0f7c65c08a72f689fe194 (patch)
treeeb5a455ce6e8bcbcd7091a04f1580fd0cf01b8fe
parentf16fe2af8d59fef156c29077a240a832d3e60ef2 (diff)
* In importPath() and exportPath(), lock the temporary directory to
prevent it from being deleted by the garbage collector.
-rw-r--r--src/libstore/local-store.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 2c0aa3579..f430492fd 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -873,6 +873,8 @@ void LocalStore::exportPath(const Path & path, bool sign,
writeInt(1, hashAndWriteSink);
Path tmpDir = createTempDir();
+ PathLocks tmpDirLock(singleton<PathSet, Path>(tmpDir));
+ tmpDirLock.setDeletion(true);
AutoDelete delTmp(tmpDir);
Path hashFile = tmpDir + "/hash";
writeFile(hashFile, printHash(hash));
@@ -922,6 +924,8 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
store path follows the archive data proper), and besides, we
don't know yet whether the signature is valid. */
Path tmpDir = createTempDir(nixStore);
+ PathLocks tmpDirLock(singleton<PathSet, Path>(tmpDir));
+ tmpDirLock.setDeletion(true);
AutoDelete delTmp(tmpDir); /* !!! could be GC'ed! */
Path unpacked = tmpDir + "/unpacked";