mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Silence some warnings on GCC 4.9
This commit is contained in:
parent
46f3eb6fdd
commit
b77037b8fd
4 changed files with 12 additions and 7 deletions
|
@ -32,7 +32,7 @@ static void sigsegvHandler(int signo, siginfo_t * info, void * ctx)
|
||||||
if (diff < 0) diff = -diff;
|
if (diff < 0) diff = -diff;
|
||||||
if (diff < 4096) {
|
if (diff < 4096) {
|
||||||
char msg[] = "error: stack overflow (possible infinite recursion)\n";
|
char msg[] = "error: stack overflow (possible infinite recursion)\n";
|
||||||
write(2, msg, strlen(msg));
|
(void) write(2, msg, strlen(msg));
|
||||||
_exit(1); // maybe abort instead?
|
_exit(1); // maybe abort instead?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1976,9 +1976,11 @@ void DerivationGoal::runChild()
|
||||||
|
|
||||||
/* Set the hostname etc. to fixed values. */
|
/* Set the hostname etc. to fixed values. */
|
||||||
char hostname[] = "localhost";
|
char hostname[] = "localhost";
|
||||||
sethostname(hostname, sizeof(hostname));
|
if (sethostname(hostname, sizeof(hostname)) == -1)
|
||||||
|
throw SysError("cannot set host name");
|
||||||
char domainname[] = "(none)"; // kernel default
|
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
|
/* Make all filesystems private. This is necessary
|
||||||
because subtrees may have been mounted as "shared"
|
because subtrees may have been mounted as "shared"
|
||||||
|
|
|
@ -109,7 +109,7 @@ void RemoteStore::connectToDaemon()
|
||||||
applications... */
|
applications... */
|
||||||
AutoCloseFD fdPrevDir = open(".", O_RDONLY);
|
AutoCloseFD fdPrevDir = open(".", O_RDONLY);
|
||||||
if (fdPrevDir == -1) throw SysError("couldn't open current directory");
|
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);
|
Path socketPathRel = "./" + baseNameOf(socketPath);
|
||||||
|
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
|
|
|
@ -698,7 +698,8 @@ static PeerInfo getPeerInfo(int remote)
|
||||||
|
|
||||||
static void daemonLoop(char * * argv)
|
static void daemonLoop(char * * argv)
|
||||||
{
|
{
|
||||||
chdir("/");
|
if (chdir("/") == -1)
|
||||||
|
throw SysError("cannot change current directory");
|
||||||
|
|
||||||
/* Get rid of children automatically; don't let them become
|
/* Get rid of children automatically; don't let them become
|
||||||
zombies. */
|
zombies. */
|
||||||
|
@ -728,7 +729,8 @@ static void daemonLoop(char * * argv)
|
||||||
/* Urgh, sockaddr_un allows path names of only 108 characters.
|
/* Urgh, sockaddr_un allows path names of only 108 characters.
|
||||||
So chdir to the socket directory so that we can pass a
|
So chdir to the socket directory so that we can pass a
|
||||||
relative path name. */
|
relative path name. */
|
||||||
chdir(dirOf(socketPath).c_str());
|
if (chdir(dirOf(socketPath).c_str()) == -1)
|
||||||
|
throw SysError("cannot change current directory");
|
||||||
Path socketPathRel = "./" + baseNameOf(socketPath);
|
Path socketPathRel = "./" + baseNameOf(socketPath);
|
||||||
|
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
|
@ -748,7 +750,8 @@ static void daemonLoop(char * * argv)
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
throw SysError(format("cannot bind to socket ‘%1%’") % socketPath);
|
throw SysError(format("cannot bind to socket ‘%1%’") % socketPath);
|
||||||
|
|
||||||
chdir("/"); /* back to the root */
|
if (chdir("/") == -1) /* back to the root */
|
||||||
|
throw SysError("cannot change current directory");
|
||||||
|
|
||||||
if (listen(fdSocket, 5) == -1)
|
if (listen(fdSocket, 5) == -1)
|
||||||
throw SysError(format("cannot listen on socket ‘%1%’") % socketPath);
|
throw SysError(format("cannot listen on socket ‘%1%’") % socketPath);
|
||||||
|
|
Loading…
Reference in a new issue