From 3a82f6a1170678e4af34c827c78270fd4a458f03 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 14 Mar 2023 18:58:12 +0100 Subject: [PATCH] Simplify commonChildInit() (cherry picked from commit 19326ac2979f0d989835105a5d816a943a6bc7f2) --- src/libstore/build.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 6910e52c5..674e240d8 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -442,7 +442,7 @@ void Goal::trace(const FormatOrString & fs) /* Common initialisation performed in child processes. */ -static void commonChildInit(Pipe & logPipe) +static void commonChildInit(int stderrFd) { restoreSignals(); @@ -454,7 +454,7 @@ static void commonChildInit(Pipe & logPipe) throw SysError(format("creating a new session")); /* Dup the write side of the logger pipe into stderr. */ - if (dup2(logPipe.writeSide.get(), STDERR_FILENO) == -1) + if (dup2(stderrFd, STDERR_FILENO) == -1) throw SysError("cannot pipe standard error into log file"); /* Dup stderr to stdout. */ @@ -678,7 +678,7 @@ HookInstance::HookInstance() /* Fork the hook. */ pid = startProcess([&]() { - commonChildInit(fromHook); + commonChildInit(fromHook.writeSide.get()); if (chdir("/") == -1) throw SysError("changing into /"); @@ -2736,7 +2736,7 @@ void DerivationGoal::runChild() try { /* child */ - commonChildInit(builderOut); + commonChildInit(builderOut.writeSide.get()); try { setupSeccomp();