1
Fork 0
mirror of https://https.git.savannah.gnu.org/git/guix.git/ synced 2025-07-12 10:00:46 +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
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

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