]> git.ipfire.org Git - thirdparty/util-linux.git/commit
nsenter: Enhance waiting for a child process
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 17 Jan 2013 00:34:17 +0000 (16:34 -0800)
committerKarel Zak <kzak@redhat.com>
Thu, 17 Jan 2013 12:17:35 +0000 (13:17 +0100)
commitc9515f86d461e8d341b9c222ffba7f4cf5e65a51
treec886e1e4ebe814bb8e35fef19e00be6f2bb4c329
parentbc7f9b95c04a8a6bb60cf2e58df47567f30cb989
nsenter: Enhance waiting for a child process

In the case of a pid namespace we need to fork a child process instead
of calling exec.  Move all of that logic out of line into a function
continue_as_child, making the logic of the primary case easier to
understand.

Update the logic for waiting for a child process to suspend ourselves
when the child processes suspends and to continue the child process
when we are unsuspsended.  This supports the bash suspend command and
various editors that suspend themselves.

If the child process exits with a signal update the logic to run
kill(getpid(), WTERMSIG(status)) so the caller sees the same exit code
that nsenter observed.

There will always be permission to send signals to our children and
the tty is not changing so there is no need for the intermediate
process to forward signals to it's child.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
sys-utils/nsenter.c