mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 07:46:21 +02:00
Simplify commonChildInit()
This commit is contained in:
parent
a387f46967
commit
19326ac297
4 changed files with 5 additions and 5 deletions
|
@ -35,7 +35,7 @@ HookInstance::HookInstance()
|
||||||
/* Fork the hook. */
|
/* Fork the hook. */
|
||||||
pid = startProcess([&]() {
|
pid = startProcess([&]() {
|
||||||
|
|
||||||
commonChildInit(fromHook);
|
commonChildInit(fromHook.writeSide.get());
|
||||||
|
|
||||||
if (chdir("/") == -1) throw SysError("changing into /");
|
if (chdir("/") == -1) throw SysError("changing into /");
|
||||||
|
|
||||||
|
|
|
@ -1649,7 +1649,7 @@ void LocalDerivationGoal::runChild()
|
||||||
|
|
||||||
try { /* child */
|
try { /* child */
|
||||||
|
|
||||||
commonChildInit(builderOut);
|
commonChildInit(builderOut.writeSide.get());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setupSeccomp();
|
setupSeccomp();
|
||||||
|
|
|
@ -1968,7 +1968,7 @@ std::string showBytes(uint64_t bytes)
|
||||||
|
|
||||||
|
|
||||||
// FIXME: move to libstore/build
|
// FIXME: move to libstore/build
|
||||||
void commonChildInit(Pipe & logPipe)
|
void commonChildInit(int stderrFd)
|
||||||
{
|
{
|
||||||
logger = makeSimpleLogger();
|
logger = makeSimpleLogger();
|
||||||
|
|
||||||
|
@ -1983,7 +1983,7 @@ void commonChildInit(Pipe & logPipe)
|
||||||
throw SysError("creating a new session");
|
throw SysError("creating a new session");
|
||||||
|
|
||||||
/* Dup the write side of the logger pipe into stderr. */
|
/* 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");
|
throw SysError("cannot pipe standard error into log file");
|
||||||
|
|
||||||
/* Dup stderr to stdout. */
|
/* Dup stderr to stdout. */
|
||||||
|
|
|
@ -704,7 +704,7 @@ typedef std::function<bool(const Path & path)> PathFilter;
|
||||||
extern PathFilter defaultPathFilter;
|
extern PathFilter defaultPathFilter;
|
||||||
|
|
||||||
/* Common initialisation performed in child processes. */
|
/* Common initialisation performed in child processes. */
|
||||||
void commonChildInit(Pipe & logPipe);
|
void commonChildInit(int stderrFd);
|
||||||
|
|
||||||
/* Create a Unix domain socket. */
|
/* Create a Unix domain socket. */
|
||||||
AutoCloseFD createUnixDomainSocket();
|
AutoCloseFD createUnixDomainSocket();
|
||||||
|
|
Loading…
Reference in a new issue