]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
loop until waitpid returns pid_child or error 278/head
authored neville <ed@s5h.net>
Sun, 20 Sep 2020 22:02:58 +0000 (23:02 +0100)
committered neville <ed@s5h.net>
Sun, 20 Sep 2020 22:04:11 +0000 (23:04 +0100)
closes #104

Signed-off-by: ed neville <ed@s5h.net>
src/su.c

index fc0e826f7106f9446cd4bc553bed8faa20b61c46..cea3f1552c0ecd8331c8f9e88f9513f43d800acf 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -354,7 +354,9 @@ static void prepare_pam_close_session (void)
                        pid_t pid;
                        stop = true;
 
-                       pid = waitpid (-1, &status, WUNTRACED);
+                       do {
+                               pid = waitpid (-1, &status, WUNTRACED);
+                       } while (pid != -1 && pid != pid_child);
 
                        /* When interrupted by signal, the signal will be
                         * forwarded to the child, and termination will be