Silence some warnings on GCC 4.9

This commit is contained in:
Eelco Dolstra 2014-12-12 17:14:28 +01:00
parent 46f3eb6fdd
commit b77037b8fd
4 changed files with 12 additions and 7 deletions

View file

@ -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"

View file

@ -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;