[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
08/27: Silence some warnings on GCC 4.9
From: |
Ludovic Courtès |
Subject: |
08/27: Silence some warnings on GCC 4.9 |
Date: |
Wed, 03 Jun 2015 22:00:36 +0000 |
civodul pushed a commit to branch nix
in repository guix.
commit b499d2efbfbe83c4683e2c778494541937c816f3
Author: Eelco Dolstra <address@hidden>
Date: Fri Dec 12 17:14:28 2014 +0100
Silence some warnings on GCC 4.9
---
nix/libstore/build.cc | 6 ++++--
nix/libstore/remote-store.cc | 2 +-
nix/nix-daemon/nix-daemon.cc | 10 +++++++---
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 7e61f96..c99bbed 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2009,9 +2009,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/nix/libstore/remote-store.cc b/nix/libstore/remote-store.cc
index 448d9b6..9d75282 100644
--- a/nix/libstore/remote-store.cc
+++ b/nix/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;
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index ecff25d..5801989 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -793,6 +793,9 @@ bool matchUser(const string & user, const string & group,
const Strings & users)
static void daemonLoop()
{
+ if (chdir("/") == -1)
+ throw SysError("cannot change current directory");
+
/* Get rid of children automatically; don't let them become
zombies. */
setSigChldAction(true);
@@ -821,7 +824,8 @@ static void daemonLoop()
/* Urgh, sockaddr_un allows path names of only 108 characters.
So chdir to the socket directory so that we can pass a
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);
struct sockaddr_un addr;
@@ -841,7 +845,8 @@ static void daemonLoop()
if (res == -1)
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)
throw SysError(format("cannot listen on socket `%1%'") %
socketPath);
@@ -945,7 +950,6 @@ void run(Strings args)
if (arg == "--daemon") /* ignored for backwards compatibility */;
}
- chdir("/");
daemonLoop();
}
- branch nix updated (3bfa70b -> e531520), Ludovic Courtès, 2015/06/03
- 01/27: Rename 'initChild' to 'runChild'., Ludovic Courtès, 2015/06/03
- 02/27: Use PR_SET_PDEATHSIG to ensure child cleanup, Ludovic Courtès, 2015/06/03
- 04/27: Get rid of unnecessary "interrupted by the user" message with -vvv, Ludovic Courtès, 2015/06/03
- 03/27: Remove tabs, Ludovic Courtès, 2015/06/03
- 07/27: Shut up a Valgrind warning, Ludovic Courtès, 2015/06/03
- 06/27: Fix some memory leaks, Ludovic Courtès, 2015/06/03
- 08/27: Silence some warnings on GCC 4.9,
Ludovic Courtès <=
- 09/27: Better error message, Ludovic Courtès, 2015/06/03
- 10/27: Explicitly include required C headers, Ludovic Courtès, 2015/06/03
- 05/27: Ensure we're writing to stderr in the builder, Ludovic Courtès, 2015/06/03
- 12/27: libutil: Improve errmsg on readLink size mismatch., Ludovic Courtès, 2015/06/03
- 13/27: libutil: Limit readLink() error to only overflows., Ludovic Courtès, 2015/06/03
- 11/27: Pedantry, Ludovic Courtès, 2015/06/03
- 14/27: Set /nix/store permission to 1737, Ludovic Courtès, 2015/06/03
- 16/27: Doh^2, Ludovic Courtès, 2015/06/03
- 17/27: Simplify printHash32, Ludovic Courtès, 2015/06/03
- 18/27: Simplify parseHash32, Ludovic Courtès, 2015/06/03