aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/daemon.cc9
-rw-r--r--src/nix/main.cc2
-rw-r--r--src/nix/prefetch.cc2
3 files changed, 6 insertions, 7 deletions
diff --git a/src/nix/daemon.cc b/src/nix/daemon.cc
index 42ce3b996..9d4afb6d9 100644
--- a/src/nix/daemon.cc
+++ b/src/nix/daemon.cc
@@ -294,7 +294,7 @@ static void daemonLoop(std::optional<TrustedFlag> forceTrustClientOpt)
if (listenFds) {
if (getEnv("LISTEN_PID") != std::to_string(getpid()) || listenFds != "1")
throw Error("unexpected systemd environment variables");
- fdSocket = SD_LISTEN_FDS_START;
+ fdSocket = AutoCloseFD{SD_LISTEN_FDS_START};
closeOnExec(fdSocket.get());
}
@@ -315,8 +315,8 @@ static void daemonLoop(std::optional<TrustedFlag> forceTrustClientOpt)
struct sockaddr_un remoteAddr;
socklen_t remoteAddrLen = sizeof(remoteAddr);
- AutoCloseFD remote = accept(fdSocket.get(),
- (struct sockaddr *) &remoteAddr, &remoteAddrLen);
+ AutoCloseFD remote{accept(fdSocket.get(),
+ (struct sockaddr *) &remoteAddr, &remoteAddrLen)};
checkInterrupt();
if (!remote) {
if (errno == EINTR) continue;
@@ -347,9 +347,8 @@ static void daemonLoop(std::optional<TrustedFlag> forceTrustClientOpt)
options.errorPrefix = "unexpected Nix daemon error: ";
options.dieWithParent = false;
options.runExitHandlers = true;
- options.allowVfork = false;
startProcess([&]() {
- fdSocket = -1;
+ fdSocket.reset();
// Background the daemon.
if (setsid() == -1)
diff --git a/src/nix/main.cc b/src/nix/main.cc
index f05c49523..a9c6c6ea2 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -243,7 +243,7 @@ static void showHelp(std::vector<std::string> subcommand, NixArgs & toplevel)
auto attr = vRes->attrs->get(state.symbols.create(mdName + ".md"));
if (!attr)
- throw UsageError("Nix has no subcommand '%s'", concatStringsSep("", subcommand));
+ throw UsageError("`nix` has no subcommand '%s'", concatStringsSep("", subcommand));
auto markdown = state.forceString(*attr->value, noPos, "while evaluating the lowdown help text");
diff --git a/src/nix/prefetch.cc b/src/nix/prefetch.cc
index 0104635fb..8f74984e0 100644
--- a/src/nix/prefetch.cc
+++ b/src/nix/prefetch.cc
@@ -92,7 +92,7 @@ std::tuple<StorePath, Hash> prefetchFile(
if (executable)
mode = 0700;
- AutoCloseFD fd = open(tmpFile.c_str(), O_WRONLY | O_CREAT | O_EXCL, mode);
+ AutoCloseFD fd{open(tmpFile.c_str(), O_WRONLY | O_CREAT | O_EXCL, mode)};
if (!fd) throw SysError("creating temporary file '%s'", tmpFile);
FdSink sink(fd.get());