Kill the child process group, rather than just the immediate child;

this is needed now that su no longer starts a controlling terminal
when not running an interactive shell (closes: Debian#713979)
This commit is contained in:
Colin Watson
2013-07-28 14:38:12 +02:00
committed by bubulle
parent 945eb8f50b
commit d172cccd07
2 changed files with 7 additions and 2 deletions

View File

@@ -181,7 +181,7 @@ static bool iswheel (const char *username)
static RETSIGTYPE kill_child (int unused(s))
{
if (0 != pid_child) {
(void) kill (pid_child, SIGKILL);
(void) kill (-pid_child, SIGKILL);
(void) fputs (_(" ...killed.\n"), stderr);
} else {
(void) fputs (_(" ...waiting for child to terminate.\n"),
@@ -370,7 +370,7 @@ static void prepare_pam_close_session (void)
(void) fputs ("\n", stderr);
(void) fputs (_("Session terminated, terminating shell..."),
stderr);
(void) kill (pid_child, caught);
(void) kill (-pid_child, caught);
}
ret = pam_close_session (pamh, 0);