about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc6
-rw-r--r--src/libstore/remote-store.cc2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 0153666c2b3a..08f44b392b00 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1976,9 +1976,11 @@ void DerivationGoal::runChild()
 
             /* Set the hostname etc. to fixed values. */
             char hostname[] = "localhost";
-            sethostname(hostname, sizeof(hostname));
+            if (sethostname(hostname, sizeof(hostname)) == -1)
+                throw SysError("cannot set host name");
             char domainname[] = "(none)"; // kernel default
-            setdomainname(domainname, sizeof(domainname));
+            if (setdomainname(domainname, sizeof(domainname)) == -1)
+                throw SysError("cannot set domain name");
 
             /* Make all filesystems private.  This is necessary
                because subtrees may have been mounted as "shared"
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 650f177986a0..16296bdc08d8 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -109,7 +109,7 @@ void RemoteStore::connectToDaemon()
        applications... */
     AutoCloseFD fdPrevDir = open(".", O_RDONLY);
     if (fdPrevDir == -1) throw SysError("couldn't open current directory");
-    chdir(dirOf(socketPath).c_str());
+    if (chdir(dirOf(socketPath).c_str()) == -1) throw SysError("couldn't change current directory");
     Path socketPathRel = "./" + baseNameOf(socketPath);
 
     struct sockaddr_un addr;