~ruther/guix-local

7bad04fac09173f63800464ca0868225f6a99bd1 — Ludovic Courtès 1 year, 6 months ago f03e6ef
daemon: Close the read end of the logging pipe.

* nix/libutil/util.cc (commonChildInit): Close ‘logPipe.readSide’.

Reported-by: Reepca Russelstein <reepca@russelstein.xyz>
Change-Id: Ia9e48d1afb85d7af52770e016f2b6832792044dd
1 files changed, 3 insertions(+), 0 deletions(-)

M nix/libutil/util.cc
M nix/libutil/util.cc => nix/libutil/util.cc +3 -0
@@ 1279,6 1279,9 @@ void commonChildInit(Pipe & logPipe)
    if (setsid() == -1)
        throw SysError(format("creating a new session"));

    /* Close the read end so only the parent holds a reference to it.  */
    logPipe.readSide.close();

    /* Dup the write side of the logger pipe into stderr. */
    if (dup2(logPipe.writeSide, STDERR_FILENO) == -1)
        throw SysError("cannot pipe standard error into log file");