From: nekral-guest Date: Tue, 23 Mar 2010 13:05:06 +0000 (+0000) Subject: * src/su.c, src/vipw.c, src/newgrp.c: When the child is X-Git-Tag: 4.1.5~284 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcd5b38cafe71b707823742781831bd8144ba2e1;p=thirdparty%2Fshadow.git * src/su.c, src/vipw.c, src/newgrp.c: When the child is interrupted, stop ourself with a SIGSTOP signal. --- diff --git a/ChangeLog b/ChangeLog index 7db41c6be..ac2fda838 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-03-23 Nicolas François + + * src/su.c, src/vipw.c, src/newgrp.c: When the child is + interrupted, stop ourself with a SIGSTOP signal. + 2010-03-23 Nicolas François * src/newgrp.c: Limit the scope of variable pid. diff --git a/src/newgrp.c b/src/newgrp.c index 167b10bf5..10204c7c6 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -322,8 +322,9 @@ static void syslog_sg (const char *name, const char *group) errno = 0; pid = waitpid (child, &cst, WUNTRACED); if ((pid == child) && (WIFSTOPPED (cst) != 0)) { - /* stop when child stops */ - kill (getpid (), WSTOPSIG(cst)); + /* The child (shell) was suspended. + * Suspend sg/newgrp. */ + kill (getpid (), SIGSTOP); /* wake child when resumed */ kill (child, SIGCONT); } diff --git a/src/su.c b/src/su.c index a0ee6d8d6..837e76c39 100644 --- a/src/su.c +++ b/src/su.c @@ -313,7 +313,7 @@ static void run_shell (const char *shellstr, char *args[], bool doshell, if (((pid_t)-1 != pid) && (0 != WIFSTOPPED (status))) { /* The child (shell) was suspended. * Suspend su. */ - kill (getpid (), WSTOPSIG(status)); + kill (getpid (), SIGSTOP); /* wake child when resumed */ kill (pid, SIGCONT); } diff --git a/src/vipw.c b/src/vipw.c index 81c4b7c7b..d3246e32d 100644 --- a/src/vipw.c +++ b/src/vipw.c @@ -310,7 +310,7 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void)) if ((pid != -1) && (WIFSTOPPED (status) != 0)) { /* The child (editor) was suspended. * Suspend vipw. */ - kill (getpid (), WSTOPSIG (status)); + kill (getpid (), SIGSTOP); /* wake child when resumed */ kill (pid, SIGCONT); } else {