From bb86a35ae5a3557b531ad6dbeccffa774aacf9d2 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 13 Jul 2012 12:10:58 -0400 Subject: common: fix child reap code --- common/gdm-common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common') 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); -- cgit v1.2.1