diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.cc | 29 | ||||
-rw-r--r-- | src/libutil/util.hh | 6 |
2 files changed, 0 insertions, 35 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 7f9413f8d..aff26e32b 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -559,33 +559,4 @@ std::string showBytes(uint64_t bytes) return fmt("%.2f MiB", bytes / (1024.0 * 1024.0)); } - -// FIXME: move to libstore/build -void commonChildInit() -{ - logger = makeSimpleLogger(); - - const static std::string pathNullDevice = "/dev/null"; - restoreProcessContext(false); - - /* Put the child in a separate session (and thus a separate - process group) so that it has no controlling terminal (meaning - that e.g. ssh cannot open /dev/tty) and it doesn't receive - terminal signals. */ - if (setsid() == -1) - throw SysError("creating a new session"); - - /* Dup stderr to stdout. */ - if (dup2(STDERR_FILENO, STDOUT_FILENO) == -1) - throw SysError("cannot dup stderr into stdout"); - - /* Reroute stdin to /dev/null. */ - int fdDevNull = open(pathNullDevice.c_str(), O_RDWR); - if (fdDevNull == -1) - throw SysError("cannot open '%1%'", pathNullDevice); - if (dup2(fdDevNull, STDIN_FILENO) == -1) - throw SysError("cannot dup null device into stdin"); - close(fdDevNull); -} - } diff --git a/src/libutil/util.hh b/src/libutil/util.hh index de5f0a2ee..e704cd709 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -407,12 +407,6 @@ struct MaintainCount /** - * Common initialisation performed in child processes. - */ -void commonChildInit(); - - -/** * Bind a Unix domain socket to a path. */ void bind(int fd, const std::string & path); |