1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

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
This commit is contained in:
Ludovic Courtès
2025-03-17 11:23:21 +01:00
parent f03e6eff2f
commit 7bad04fac0

View File

@@ -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");