about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-02-21T15·45+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-02-21T15·45+0000
commit43c4d18c6a4e1a8b129114439718e26c12b49ca8 (patch)
tree9e8927fbb240928c5d2f2a9fcee0f366d5630058 /src/libutil/util.cc
parent46e0919ced4646004cc0701b188d0a68e24e8924 (diff)
* `nix-store --import': import an archive created by `nix-store
  --export' into the Nix store, and optionally check the cryptographic
  signatures against /nix/etc/nix/signing-key.pub.  (TODO: verify
  against a set of public keys.)

Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 7671c7c7e4..1576e1e8b0 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -317,19 +317,19 @@ void makePathReadOnly(const Path & path)
 }
 
 
-static Path tempName()
+static Path tempName(const Path & tmpRoot)
 {
     static int counter = 0;
-    Path tmpRoot = canonPath(getEnv("TMPDIR", "/tmp"), true);
-    return (format("%1%/nix-%2%-%3%") % tmpRoot % getpid() % counter++).str();
+    Path tmpRoot2 = canonPath(tmpRoot.empty() ? getEnv("TMPDIR", "/tmp") : tmpRoot, true);
+    return (format("%1%/nix-%2%-%3%") % tmpRoot2 % getpid() % counter++).str();
 }
 
 
-Path createTempDir()
+Path createTempDir(const Path & tmpRoot)
 {
     while (1) {
         checkInterrupt();
-	Path tmpDir = tempName();
+	Path tmpDir = tempName(tmpRoot);
 	if (mkdir(tmpDir.c_str(), 0777) == 0) {
 	    /* Explicitly set the group of the directory.  This is to
 	       work around around problems caused by BSD's group