[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
76/376: nix-daemon: Simplify stderr handling
From: |
Ludovic Courtès |
Subject: |
76/376: nix-daemon: Simplify stderr handling |
Date: |
Wed, 28 Jan 2015 22:04:09 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit d0fad1779f85d4d356d658e99458734e9ab5809a
Author: Eelco Dolstra <address@hidden>
Date: Wed Jul 23 19:37:40 2014 +0200
nix-daemon: Simplify stderr handling
---
src/libutil/util.cc | 1 +
src/nix-daemon/nix-daemon.cc | 8 +-------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 32244b2..aa9d99e 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -850,6 +850,7 @@ pid_t startProcess(std::function<void()> fun, const string
& errorPrefix)
if (pid == -1) throw SysError("unable to fork");
if (pid == 0) {
+ _writeToStderr = defaultWriteToStderr;
try {
restoreAffinity();
fun();
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 250d036..83d9207 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -29,7 +29,6 @@ static FdSource from(STDIN_FILENO);
static FdSink to(STDOUT_FILENO);
bool canSendStderr;
-pid_t myPid;
/* This function is called anytime we want to write something to
@@ -38,11 +37,7 @@ pid_t myPid;
socket. */
static void tunnelStderr(const unsigned char * buf, size_t count)
{
- /* Don't send the message to the client if we're a child of the
- process handling the connection. Otherwise we could screw up
- the protocol. It's up to the parent to redirect stderr and
- send it to the client somehow (e.g., as in build.cc). */
- if (canSendStderr && myPid == getpid()) {
+ if (canSendStderr) {
try {
writeInt(STDERR_NEXT, to);
writeString(buf, count, to);
@@ -533,7 +528,6 @@ static void processConnection(bool trusted)
MonitorFdHup monitor(from.fd);
canSendStderr = false;
- myPid = getpid();
_writeToStderr = tunnelStderr;
/* Exchange the greeting. */
- 61/376: Handle case collisions on case-insensitive systems, (continued)
- 61/376: Handle case collisions on case-insensitive systems, Ludovic Courtès, 2015/01/28
- 66/376: nix-daemon: Show name of connecting user, Ludovic Courtès, 2015/01/28
- 59/376: Install systemd and Upstart stuff only on Linux, Ludovic Courtès, 2015/01/28
- 60/376: Make dev-shell script work on Darwin, Ludovic Courtès, 2015/01/28
- 68/376: Ugly hack to fix building on old Darwin, Ludovic Courtès, 2015/01/28
- 75/376: nix-store --serve: Monitor for client disconnects, Ludovic Courtès, 2015/01/28
- 70/376: Better fix for strcasecmp on Darwin, Ludovic Courtès, 2015/01/28
- 73/376: startProcess: Make writing error messages from the child more robust, Ludovic Courtès, 2015/01/28
- 67/376: nix-daemon: Add trusted-users and allowed-users options, Ludovic Courtès, 2015/01/28
- 56/376: Remove cruft, Ludovic Courtès, 2015/01/28
- 76/376: nix-daemon: Simplify stderr handling,
Ludovic Courtès <=
- 71/376: Revert old useBuildHook behaviour, Ludovic Courtès, 2015/01/28
- 65/376: nix-daemon: Only print connection info if we have SO_PEERCRED, Ludovic Courtès, 2015/01/28
- 69/376: Bump, Ludovic Courtès, 2015/01/28
- 62/376: Be more strict about file names in NARs, Ludovic Courtès, 2015/01/28
- 78/376: Pass -pthread only for programs that need it, Ludovic Courtès, 2015/01/28
- 80/376: Remove some dead code, Ludovic Courtès, 2015/01/28
- 72/376: Remove dead code, Ludovic Courtès, 2015/01/28
- 81/376: Add some assertions, Ludovic Courtès, 2015/01/28
- 82/376: More debugging, Ludovic Courtès, 2015/01/28
- 85/376: tests/remote-builds.nix: Don't try cache.nixos.org, Ludovic Courtès, 2015/01/28