[not-for-applying PATCH] nsenter: do not self-suspend if child is suspended

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



nsenter would kill(self, SIGSTOP) when the child was stopped,
making it possible to use 'suspend -f' in the child shell to
suspend both the shell and the parent nsenter process. Unfortunately
this interferes with other uses of SIGSTOP, since nsenter process
is not visible in the child PID namespace and can be only resumed
from outside.
---
 sys-utils/nsenter.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/sys-utils/nsenter.c b/sys-utils/nsenter.c
index 106349c..5cef4bf 100644
--- a/sys-utils/nsenter.c
+++ b/sys-utils/nsenter.c
@@ -129,7 +129,6 @@ static void continue_as_child(void)
 {
 	pid_t child = fork();
 	int status;
-	pid_t ret;
 
 	if (child < 0)
 		err(EXIT_FAILURE, _("fork failed"));
@@ -138,16 +137,8 @@ static void continue_as_child(void)
 	if (child == 0)
 		return;
 
-	for (;;) {
-		ret = waitpid(child, &status, WUNTRACED);
-		if ((ret == child) && (WIFSTOPPED(status))) {
-			/* The child suspended so suspend us as well */
-			kill(getpid(), SIGSTOP);
-			kill(child, SIGCONT);
-		} else {
-			break;
-		}
-	}
+	waitpid(child, &status, 0);
+
 	/* Return the child's exit code if possible */
 	if (WIFEXITED(status)) {
 		exit(WEXITSTATUS(status));
-- 
1.8.2.562.g931e949

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux