[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
357/376: Silence some warnings on GCC 4.9
From: |
Ludovic Courtès |
Subject: |
357/376: Silence some warnings on GCC 4.9 |
Date: |
Wed, 28 Jan 2015 22:06:10 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit b77037b8fdd89cc06d80c3564e4a4f4a4fe8aa1d
Author: Eelco Dolstra <address@hidden>
Date: Fri Dec 12 17:14:28 2014 +0100
Silence some warnings on GCC 4.9
---
src/libmain/stack.cc | 2 +-
src/libstore/build.cc | 6 ++++--
src/libstore/remote-store.cc | 2 +-
src/nix-daemon/nix-daemon.cc | 9 ++++++---
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/libmain/stack.cc b/src/libmain/stack.cc
index b670e69..41b617d 100644
--- a/src/libmain/stack.cc
+++ b/src/libmain/stack.cc
@@ -32,7 +32,7 @@ static void sigsegvHandler(int signo, siginfo_t * info, void
* ctx)
if (diff < 0) diff = -diff;
if (diff < 4096) {
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?
}
}
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 0153666..08f44b3 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 650f177..16296bd 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;
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 12efd46..bed7de0 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -698,7 +698,8 @@ static PeerInfo getPeerInfo(int remote)
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
zombies. */
@@ -728,7 +729,8 @@ static void daemonLoop(char * * argv)
/* 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;
@@ -748,7 +750,8 @@ static void daemonLoop(char * * argv)
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);
- 347/376: Remove canary stuff, (continued)
- 347/376: Remove canary stuff, Ludovic Courtès, 2015/01/28
- 348/376: Remove dead code, Ludovic Courtès, 2015/01/28
- 350/376: Doh, Ludovic Courtès, 2015/01/28
- 338/376: Don't wait for PID -1, Ludovic Courtès, 2015/01/28
- 352/376: Get rid of unnecessary "interrupted by the user" message with -vvv, Ludovic Courtès, 2015/01/28
- 353/376: Don't abort if we get a signal while waiting for the pager, Ludovic Courtès, 2015/01/28
- 351/376: Remove chatty message, Ludovic Courtès, 2015/01/28
- 356/376: Shut up a Valgrind warning, Ludovic Courtès, 2015/01/28
- 349/376: Remove tabs, Ludovic Courtès, 2015/01/28
- 355/376: Fix some memory leaks, Ludovic Courtès, 2015/01/28
- 357/376: Silence some warnings on GCC 4.9,
Ludovic Courtès <=
- 358/376: Install cacert before running nix-channel, Ludovic Courtès, 2015/01/28
- 359/376: Better error message, Ludovic Courtès, 2015/01/28
- 362/376: Undocument nix-generate-patches, Ludovic Courtès, 2015/01/28
- 367/376: Fix image in PDF, Ludovic Courtès, 2015/01/28
- 354/376: Ensure we're writing to stderr in the builder, Ludovic Courtès, 2015/01/28
- 360/376: Style, Ludovic Courtès, 2015/01/28
- 365/376: Update .nixpkg description, Ludovic Courtès, 2015/01/28
- 366/376: Rename files, Ludovic Courtès, 2015/01/28
- 371/376: Merge commit '36c67860363c93eb00cf5b8e2ad34f6f775e6901', Ludovic Courtès, 2015/01/28
- 363/376: Style, Ludovic Courtès, 2015/01/28