diff options
author | Ludovic Courtès <ludo@gnu.org> | 2025-03-17 11:23:21 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-03-26 17:57:43 +0100 |
commit | 7bad04fac09173f63800464ca0868225f6a99bd1 (patch) | |
tree | a6f5f9d30f8942d996bf31815a58acc4955c7fbc | |
parent | f03e6eff2f491fbf1a38b36d46c0fe2fdd3e6886 (diff) | |
download | guix-7bad04fac09173f63800464ca0868225f6a99bd1.tar.gz guix-7bad04fac09173f63800464ca0868225f6a99bd1.zip |
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
-rw-r--r-- | nix/libutil/util.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc index eb2d16e1cc..56f116046c 100644 --- a/nix/libutil/util.cc +++ b/nix/libutil/util.cc @@ -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"); |