From d172cccd07c0edbfe4a5582358c16128c736bd23 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 28 Jul 2013 14:38:12 +0200 Subject: [PATCH] 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) --- ChangeLog | 5 +++++ src/su.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ad5dffc..1b90ceea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,11 @@ * configure.in: Prepare for next point release 4.2. * if using the static char* for pw_dir, strdup it so pw_free() can be used. (Closes: Debian#691459) + * 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) + Thansk to Colin Watson for the patch. 2012-05-25 Nicolas François diff --git a/src/su.c b/src/su.c index 0e9d807f..98ea6de3 100644 --- a/src/su.c +++ b/src/su.c @@ -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);