From 01a8df79b35a620bffba2590533e3cfd8f6cb6db Mon Sep 17 00:00:00 2001 From: ed neville Date: Sun, 20 Sep 2020 23:02:58 +0100 Subject: [PATCH] loop until waitpid returns pid_child or error closes #104 Signed-off-by: ed neville --- src/su.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/su.c b/src/su.c index fc0e826f..cea3f155 100644 --- 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