* src/su.c, src/vipw.c, src/newgrp.c: When the child is
interrupted, stop ourself with a SIGSTOP signal.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2010-03-23 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* 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 <nicolas.francois@centraliens.net>
|
2010-03-23 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/newgrp.c: Limit the scope of variable pid.
|
* src/newgrp.c: Limit the scope of variable pid.
|
||||||
|
@@ -322,8 +322,9 @@ static void syslog_sg (const char *name, const char *group)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
pid = waitpid (child, &cst, WUNTRACED);
|
pid = waitpid (child, &cst, WUNTRACED);
|
||||||
if ((pid == child) && (WIFSTOPPED (cst) != 0)) {
|
if ((pid == child) && (WIFSTOPPED (cst) != 0)) {
|
||||||
/* stop when child stops */
|
/* The child (shell) was suspended.
|
||||||
kill (getpid (), WSTOPSIG(cst));
|
* Suspend sg/newgrp. */
|
||||||
|
kill (getpid (), SIGSTOP);
|
||||||
/* wake child when resumed */
|
/* wake child when resumed */
|
||||||
kill (child, SIGCONT);
|
kill (child, SIGCONT);
|
||||||
}
|
}
|
||||||
|
2
src/su.c
2
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))) {
|
if (((pid_t)-1 != pid) && (0 != WIFSTOPPED (status))) {
|
||||||
/* The child (shell) was suspended.
|
/* The child (shell) was suspended.
|
||||||
* Suspend su. */
|
* Suspend su. */
|
||||||
kill (getpid (), WSTOPSIG(status));
|
kill (getpid (), SIGSTOP);
|
||||||
/* wake child when resumed */
|
/* wake child when resumed */
|
||||||
kill (pid, SIGCONT);
|
kill (pid, SIGCONT);
|
||||||
}
|
}
|
||||||
|
@@ -310,7 +310,7 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
|
|||||||
if ((pid != -1) && (WIFSTOPPED (status) != 0)) {
|
if ((pid != -1) && (WIFSTOPPED (status) != 0)) {
|
||||||
/* The child (editor) was suspended.
|
/* The child (editor) was suspended.
|
||||||
* Suspend vipw. */
|
* Suspend vipw. */
|
||||||
kill (getpid (), WSTOPSIG (status));
|
kill (getpid (), SIGSTOP);
|
||||||
/* wake child when resumed */
|
/* wake child when resumed */
|
||||||
kill (pid, SIGCONT);
|
kill (pid, SIGCONT);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user