[gdm/wip/slave-connection: 3/38] common: fix child reap code



commit d55741a088d588f36fee21e14c8b38e07501af60
Author: Ray Strode <rstrode redhat com>
Date:   Fri Jul 13 12:10:58 2012 -0400

    common: fix child reap code

 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 e035dfd..d6822a0 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]