From f6e8b236589d110e2875920a98d0a45b5bed2626 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 16 Aug 2017 13:57:41 +0200 Subject: [PATCH] su: fix refactoring bug in child PID usage Fix child pid cleanup according to commit 0076012563ff34e294a6166d605118bcdd35f7e1. Signed-off-by: Karel Zak --- login-utils/su-common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/login-utils/su-common.c b/login-utils/su-common.c index f7bd3479e7..589445b316 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -347,14 +347,15 @@ static int wait_for_child(struct su_context *su) status = WTERMSIG(status) + 128; } else status = WEXITSTATUS(status); + + DBG(SIG, ul_debug("child %d is dead", su->child)); + su->child = (pid_t) -1; /* Don't use the PID anymore! */ } else if (caught_signal) status = caught_signal + 128; else status = 1; - DBG(SIG, ul_debug("child %d is dead [status=%d]", su->child, status)); - su->child = (pid_t) -1; /* Don't use the PID anymore! */ - + DBG(SIG, ul_debug("status=%d", status)); return status; } -- 2.47.2