[glib/wip/child-catchall: 1/3] gmain: Handle EINTR from waitpid()



commit 83099ab2b4cf8e828b8847960b2f60bd2f444c88
Author: Colin Walters <walters verbum org>
Date:   Mon Oct 29 15:44:16 2012 -0400

    gmain: Handle EINTR from waitpid()
    
    Just on general principle.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687061

 glib/gmain.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/glib/gmain.c b/glib/gmain.c
index 133b0f1..1b313e2 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -4421,12 +4421,17 @@ dispatch_unix_signals (void)
 
           if (!source->child_exited)
             {
-              if (waitpid (source->pid, &source->child_status, WNOHANG) > 0)
+              int res;
+              do
                 {
-                  source->child_exited = TRUE;
-
-                  wake_source ((GSource *) source);
+                  res = waitpid (source->pid, &source->child_status, WNOHANG);
+                  if (res > 0)
+                    {
+                      source->child_exited = TRUE;
+                      wake_source ((GSource *) source);
+                    }
                 }
+              while (res == -1 && errno == EINTR);
             }
         }
     }



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