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

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to