]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
su: fix refactoring bug in child PID usage
authorKarel Zak <kzak@redhat.com>
Wed, 16 Aug 2017 11:57:41 +0000 (13:57 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Sep 2017 09:48:56 +0000 (11:48 +0200)
Fix child pid cleanup according to commit 0076012563ff34e294a6166d605118bcdd35f7e1.

Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/su-common.c

index f7bd3479e7334abd6b89e527544508598c6a2adb..589445b3161af9a7ecbcc6122569a871df9c3901 100644 (file)
@@ -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;
 }