diff --git a/ChangeLog b/ChangeLog index dbf70e26..84d1e260 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-05-18 Nicolas François + + * src/vipw.c, src/su.c, src/newgrp.c: Harmonize the children's + SIGSTOP handling. Raise the signal which stopped the child instead + of always SIGSTOP. + +2008-05-18 Nicolas François + + Import Debian patch 406_vipw_resume_properly. + Thanks to Dean Gaudet. + * NEWS, src/vipw.c: Resume properly after ^Z. + 2008-04-27 Nicolas François * lib/getdef.c, lib/lockpw.c, lib/utent.c, lib/sgetgrent.c, diff --git a/NEWS b/NEWS index f5d42106..c0e1c5b6 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ shadow-4.1.1 -> shadow-4.1.2 UNRELEASED * If the SULOG_FILE does not exist when an su session is logged, make sure the file is created with group root, instead of using the group of the caller. +- vipw + * Resume properly after ^Z. shadow-4.1.0 -> shadow-4.1.1 02-04-2008 diff --git a/src/newgrp.c b/src/newgrp.c index 3e8d2faf..b1b37ff1 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -294,7 +294,7 @@ static void syslog_sg (const char *name, const char *group) pid = waitpid (child, &cst, WUNTRACED); if (pid == child && WIFSTOPPED (cst)) { /* stop when child stops */ - raise (SIGSTOP); + kill (getpid (), WSTOPSIG(status)); /* wake child when resumed */ kill (child, SIGCONT); } diff --git a/src/su.c b/src/su.c index 6ff190bc..154701fe 100644 --- a/src/su.c +++ b/src/su.c @@ -238,9 +238,11 @@ static void run_shell (const char *shellstr, char *args[], int doshell, pid = waitpid (-1, &status, WUNTRACED); - if (WIFSTOPPED (status)) { - kill (getpid (), SIGSTOP); - /* once we get here, we must have resumed */ + if ((pid != -1) && WIFSTOPPED (status)) { + /* The child (shell) was suspended. + * Suspend su. */ + kill (getpid (), WSTOPSIG(status)); + /* wake child when resumed */ kill (pid, SIGCONT); } } while (WIFSTOPPED (status)); diff --git a/src/vipw.c b/src/vipw.c index 9d2e604c..7a778b9d 100644 --- a/src/vipw.c +++ b/src/vipw.c @@ -209,9 +209,12 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void)) for (;;) { pid = waitpid (pid, &status, WUNTRACED); - if (WIFSTOPPED (status)) { - kill (getpid (), SIGSTOP); - kill (getpid (), SIGCONT); + if ((pid != -1) && WIFSTOPPED (status)) { + /* The child (editor) was suspended. + * Suspend vipw. */ + kill (getpid (), WSTOPSIG(status)); + /* wake child when resumed */ + kill (pid, SIGCONT); } else break; }