* 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. Import Debian patch 406_vipw_resume_properly. Thanks to Dean Gaudet. * NEWS, src/vipw.c: Resume properly after ^Z.
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
8
src/su.c
8
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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user