forked from lix-project/lix
Cleanup
This commit is contained in:
parent
16db8dc96f
commit
515662ad70
4 changed files with 7 additions and 8 deletions
|
@ -35,7 +35,10 @@ HookInstance::HookInstance()
|
|||
/* Fork the hook. */
|
||||
pid = startProcess([&]() {
|
||||
|
||||
commonChildInit(fromHook.writeSide.get());
|
||||
if (dup2(fromHook.writeSide.get(), STDERR_FILENO) == -1)
|
||||
throw SysError("cannot pipe standard error into log file");
|
||||
|
||||
commonChildInit();
|
||||
|
||||
if (chdir("/") == -1) throw SysError("changing into /");
|
||||
|
||||
|
|
|
@ -1656,7 +1656,7 @@ void LocalDerivationGoal::runChild()
|
|||
|
||||
try { /* child */
|
||||
|
||||
commonChildInit(-1);
|
||||
commonChildInit();
|
||||
|
||||
try {
|
||||
setupSeccomp();
|
||||
|
|
|
@ -1968,7 +1968,7 @@ std::string showBytes(uint64_t bytes)
|
|||
|
||||
|
||||
// FIXME: move to libstore/build
|
||||
void commonChildInit(int stderrFd)
|
||||
void commonChildInit()
|
||||
{
|
||||
logger = makeSimpleLogger();
|
||||
|
||||
|
@ -1982,10 +1982,6 @@ void commonChildInit(int stderrFd)
|
|||
if (setsid() == -1)
|
||||
throw SysError("creating a new session");
|
||||
|
||||
/* Dup the write side of the logger pipe into stderr. */
|
||||
if (stderrFd != -1 && dup2(stderrFd, STDERR_FILENO) == -1)
|
||||
throw SysError("cannot pipe standard error into log file");
|
||||
|
||||
/* Dup stderr to stdout. */
|
||||
if (dup2(STDERR_FILENO, STDOUT_FILENO) == -1)
|
||||
throw SysError("cannot dup stderr into stdout");
|
||||
|
|
|
@ -704,7 +704,7 @@ typedef std::function<bool(const Path & path)> PathFilter;
|
|||
extern PathFilter defaultPathFilter;
|
||||
|
||||
/* Common initialisation performed in child processes. */
|
||||
void commonChildInit(int stderrFd);
|
||||
void commonChildInit();
|
||||
|
||||
/* Create a Unix domain socket. */
|
||||
AutoCloseFD createUnixDomainSocket();
|
||||
|
|
Loading…
Reference in a new issue