From: Karel Zak Date: Wed, 16 Aug 2017 11:57:41 +0000 (+0200) Subject: su: fix refactoring bug in child PID usage X-Git-Tag: v2.31-rc1~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f6e8b236589d110e2875920a98d0a45b5bed2626;p=thirdparty%2Futil-linux.git su: fix refactoring bug in child PID usage Fix child pid cleanup according to commit 0076012563ff34e294a6166d605118bcdd35f7e1. Signed-off-by: Karel Zak --- 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; }