about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-10-13T20·41-0400
committerEelco Dolstra <edolstra@gmail.com>2020-01-04T12·41+0100
commit421f1f44931d69528f761d9540e5c4fe69339b6e (patch)
tree08d92f160b9faa20c65ab3da3c8e712147c7efb9 /src/libstore/build.cc
parent10bf5340ca35269153aca67ecd35f5419d0a08bc (diff)
Move tmpDirInSandbox to initTmpDir
(cherry picked from commit 96c84937c49435525d0733437aa88902b2c8caf6)
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 573bd14297..d04513ddb8 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1964,13 +1964,6 @@ void DerivationGoal::startBuilder()
     auto drvName = storePathToName(drvPath);
     tmpDir = createTempDir("", "nix-build-" + drvName, false, false, 0700);
 
-    /* In a sandbox, for determinism, always use the same temporary
-       directory. */
-#if __linux__
-    tmpDirInSandbox = useChroot ? settings.sandboxBuildDir : tmpDir;
-#else
-    tmpDirInSandbox = tmpDir;
-#endif
     chownToBuilder(tmpDir);
 
     /* Substitute output placeholders with the actual output paths. */
@@ -2388,7 +2381,6 @@ void DerivationGoal::startBuilder()
         int res = helper.wait();
         if (res != 0 && settings.sandboxFallback) {
             useChroot = false;
-            tmpDirInSandbox = tmpDir;
             initTmpDir();
             goto fallback;
         } else if (res != 0)
@@ -2447,6 +2439,14 @@ void DerivationGoal::startBuilder()
 
 
 void DerivationGoal::initTmpDir() {
+    /* In a sandbox, for determinism, always use the same temporary
+       directory. */
+#if __linux__
+    tmpDirInSandbox = useChroot ? settings.sandboxBuildDir : tmpDir;
+#else
+    tmpDirInSandbox = tmpDir;
+#endif
+
     /* In non-structured mode, add all bindings specified in the
        derivation via the environment, except those listed in the
        passAsFile attribute. Those are passed as file names pointing