summaryrefslogtreecommitdiffstats
path: root/login-utils
diff options
context:
space:
mode:
authorKarel Zak2017-08-16 13:57:41 +0200
committerKarel Zak2017-09-18 11:48:56 +0200
commitf6e8b236589d110e2875920a98d0a45b5bed2626 (patch)
tree5d731c1f0e5bfd2573be051ac217c96b979936b8 /login-utils
parentsu: add child to control struct (diff)
downloadkernel-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.c7
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;
}