about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-06-16T18·02+0200
committerEelco Dolstra <edolstra@gmail.com>2019-06-16T18·02+0200
commit2743bf0bb1727056ce6d6d6be4e38c3251aac1f8 (patch)
tree9482d3daee8155fb9faf04bdb01f8b9c638bbab7 /src/libstore/build.cc
parent82ca6ef390b752faf1bf27b22daa34b29a4b00d4 (diff)
Hopefully fix macOS tests
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 5a75403cfc..cccf0c7c68 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2190,11 +2190,13 @@ void DerivationGoal::startBuilder()
 
     std::string slaveName(ptsname(builderOut.readSide.get()));
 
-    if (chmod(slaveName.c_str(), 0600))
-        throw SysError("changing mode of pseudoterminal slave");
+    if (buildUser) {
+        if (chmod(slaveName.c_str(), 0600))
+            throw SysError("changing mode of pseudoterminal slave");
 
-    if (buildUser && chown(slaveName.c_str(), buildUser->getUID(), 0))
-        throw SysError("changing owner of pseudoterminal slave");
+        if (chown(slaveName.c_str(), buildUser->getUID(), 0))
+            throw SysError("changing owner of pseudoterminal slave");
+    }
 
     #if 0
     // Mount the pt in the sandbox so that the "tty" command works.