about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-01T17·29+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-01T17·29+0200
commit4c4b219c07c08c709c94af6f3fe1f25dea0563a0 (patch)
treec0ef03604dfd6a807bea25a8431a3064174e4bb3 /src/libstore/build.cc
parenteea0401d7a8ed1292f71d697e7a59c429aa18d5d (diff)
Call commonChildInit() before doing chroot init
This ensures that daemon clients see error messages from the chroot
setup.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 479bc4a243..03aea8b8e8 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -374,8 +374,6 @@ void Goal::trace(const format & f)
 /* Common initialisation performed in child processes. */
 static void commonChildInit(Pipe & logPipe)
 {
-    restoreAffinity();
-
     /* Put the child in a separate session (and thus a separate
        process group) so that it has no controlling terminal (meaning
        that e.g. ssh cannot open /dev/tty) and it doesn't receive
@@ -1962,6 +1960,12 @@ void DerivationGoal::initChild()
 
     try { /* child */
 
+        _writeToStderr = 0;
+
+        restoreAffinity();
+
+        commonChildInit(builderOut);
+
 #if CHROOT_ENABLED
         if (useChroot) {
             /* Initialise the loopback interface. */
@@ -2080,8 +2084,6 @@ void DerivationGoal::initChild()
         }
 #endif
 
-        commonChildInit(builderOut);
-
         if (chdir(tmpDir.c_str()) == -1)
             throw SysError(format("changing into `%1%'") % tmpDir);