diff options
author | Ray Strode <rstrode@redhat.com> | 2012-07-13 12:10:58 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2012-07-13 15:21:25 -0400 |
commit | bb86a35ae5a3557b531ad6dbeccffa774aacf9d2 (patch) | |
tree | 8905c34f56360142cb8fcd2b9bb244ff40f8fdeb /common | |
parent | dba5ee4c517b9156f70d389bfe31b64d3b7965cc (diff) | |
download | gdm-bb86a35ae5a3557b531ad6dbeccffa774aacf9d2.tar.gz |
common: fix child reap code
Diffstat (limited to 'common')
-rw-r--r-- | common/gdm-common.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/common/gdm-common.c b/common/gdm-common.c index e035dfd7..d6822a01 100644 --- a/common/gdm-common.c +++ b/common/gdm-common.c @@ -91,6 +91,7 @@ gdm_wait_on_and_disown_pid (int pid, int ret; int num_tries; int flags; + gboolean already_reaped; if (timeout > 0) { flags = WNOHANG; @@ -101,12 +102,13 @@ gdm_wait_on_and_disown_pid (int pid, } wait_again: errno = 0; + already_reaped = FALSE; ret = waitpid (pid, &status, flags); if (ret < 0) { if (errno == EINTR) { goto wait_again; } else if (errno == ECHILD) { - ; /* do nothing, child already reaped */ + already_reaped = TRUE; } else { g_debug ("GdmCommon: waitpid () should not fail"); } @@ -137,9 +139,11 @@ gdm_wait_on_and_disown_pid (int pid, g_debug ("GdmCommon: process (pid:%d) done (%s:%d)", (int) pid, + already_reaped? "reaped earlier" : WIFEXITED (status) ? "status" : WIFSIGNALED (status) ? "signal" : "unknown", + already_reaped? 1 : WIFEXITED (status) ? WEXITSTATUS (status) : WIFSIGNALED (status) ? WTERMSIG (status) : -1); |