]> granicus.if.org Git - shadow/commitdiff
* src/vipw.c, src/su.c, src/newgrp.c: Harmonize the children's
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 18 May 2008 13:41:56 +0000 (13:41 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 18 May 2008 13:41:56 +0000 (13:41 +0000)
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.

ChangeLog
NEWS
src/newgrp.c
src/su.c
src/vipw.c

index dbf70e26f5dbe05f1c3c5cb2bc2d8c83b7b9cd5b..84d1e26010dec89210bf2846e8f8386f49c50e68 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-05-18  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * 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  <nicolas.francois@centraliens.net>
+
+       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  <nicolas.francois@centraliens.net>
 
        * lib/getdef.c, lib/lockpw.c, lib/utent.c, lib/sgetgrent.c,
diff --git a/NEWS b/NEWS
index f5d42106083414fdd9550f708259c190ee9b75e7..c0e1c5b6b7445e654dcc77c1d40a6f5761960308 100644 (file)
--- 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
 
index 3e8d2faf020dde36d19f999f6360ce5ac8856e5e..b1b37ff1ef880eb1ccfb452a344ce7d419d383f1 100644 (file)
@@ -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);
                                }
index 6ff190bc2ca658f11ca6d0b8c3538cbb90003510..154701fe41393b1561641e4fd8ae50d0bafd13d1 100644 (file)
--- 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));
index 9d2e604c9595774b7ef154efc097ea22eae520a5..7a778b9de54013eb55fbffcc73de16411c955a89 100644 (file)
@@ -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;
        }