about summary refs log tree commit diff
path: root/src/exec.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/exec.cc')
-rw-r--r--src/exec.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/exec.cc b/src/exec.cc
index e9ddb5ee14ca..2e092b2e0dd6 100644
--- a/src/exec.cc
+++ b/src/exec.cc
@@ -54,11 +54,7 @@ void runProgram(const string & program,
 
     /* Create a temporary directory where the build will take
        place. */
-    static int counter = 0;
-    string tmpDir = (format("/tmp/nix-%1%-%2%") % getpid() % counter++).str();
-
-    if (mkdir(tmpDir.c_str(), 0777) == -1)
-        throw SysError(format("creating directory `%1%'") % tmpDir);
+    string tmpDir = createTempDir();
 
     AutoDelete delTmpDir(tmpDir);