diff options
author | Karel Zak | 2017-08-16 13:57:41 +0200 |
---|---|---|
committer | Karel Zak | 2017-09-18 11:48:56 +0200 |
commit | f6e8b236589d110e2875920a98d0a45b5bed2626 (patch) | |
tree | 5d731c1f0e5bfd2573be051ac217c96b979936b8 /login-utils | |
parent | su: add child to control struct (diff) | |
download | kernel-qcow2-util-linux-f6e8b236589d110e2875920a98d0a45b5bed2626.tar.gz kernel-qcow2-util-linux-f6e8b236589d110e2875920a98d0a45b5bed2626.tar.xz kernel-qcow2-util-linux-f6e8b236589d110e2875920a98d0a45b5bed2626.zip |
su: fix refactoring bug in child PID usage
Fix child pid cleanup according to commit 0076012563ff34e294a6166d605118bcdd35f7e1.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r-- | login-utils/su-common.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/login-utils/su-common.c b/login-utils/su-common.c index f7bd3479e..589445b31 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; } |