[gdm] common: fix child reap code



commit bb86a35ae5a3557b531ad6dbeccffa774aacf9d2
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]