Index: glib/gmain.c
===================================================================
RCS file: /cvs/gnome/glib/glib/gmain.c,v
retrieving revision 1.122
diff -u -p -r1.122 gmain.c
--- glib/gmain.c	24 Oct 2004 01:37:42 -0000	1.122
+++ glib/gmain.c	30 Oct 2004 12:12:03 -0000
@@ -3743,6 +3743,22 @@ g_child_watch_add_full (gint            
   id = g_source_attach (source, NULL);
   g_source_unref (source);
 
+/*   if (g_child_watch_check (source)) */
+/*       g_message("Child %i exited", pid); */
+
+#ifdef G_OS_UNIX
+  {
+      GChildWatchSource *child_watch_source = (GChildWatchSource *) source;
+      gint child_status;
+        /* check if child exited very quickly, before starting to be monitored */
+      if (waitpid (child_watch_source->pid, &child_status, WNOHANG) > 0)
+      {
+          child_watch_source->child_status = child_status;
+          child_watch_source->child_exited = TRUE;
+      }
+  }
+#endif
+
   return id;
 }
 
