--- glib/gmain.c.orig	2004-07-20 16:41:55.140989000 -0500
+++ glib/gmain.c	2004-07-20 16:42:42.091346000 -0500
@@ -3570,7 +3570,11 @@
 
   child_watch_init_state = CHILD_WATCH_INITIALIZED_SINGLE;
 
+#ifdef SIGNAL_RESET_TO_SIG_DFL
+  sigset (SIGCHLD, g_child_watch_signal_handler);
+#else
   signal (SIGCHLD, g_child_watch_signal_handler);
+#endif
 }
 
 static gpointer
@@ -3630,7 +3634,11 @@
   if (g_thread_create (child_watch_helper_thread, NULL, FALSE, &error) == NULL)
     g_error ("Cannot create a thread to monitor child exit status: %s\n", error->message);
   child_watch_init_state = CHILD_WATCH_INITIALIZED_THREADED;
+#ifdef SIGNAL_RESET_TO_SIG_DFL
+  sigset (SIGCHLD, g_child_watch_signal_handler);
+#else
   signal (SIGCHLD, g_child_watch_signal_handler);
+#endif
 }
 
 static void
--- configure.in.orig	2004-07-09 08:31:38.000000000 -0500
+++ configure.in	2004-08-03 14:04:54.000000000 -0500
@@ -849,6 +807,36 @@
     AC_DEFINE(NO_SYS_SIGLIST_DECL,1,[global 'sys_siglist' not declared])
 fi
 
+# Check if signal handler is set to SIG_DFL after signal
+# (courtesy Thomas Thorberger)
+AC_MSG_CHECKING([if signal handler is set to SIG_DFL after signal])
+AC_RUN_IFELSE([#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <unistd.h>
+
+int sig;
+
+void handler(int x) {
+  sig++;
+}
+
+int
+main (void) {
+  sig=0;
+  signal (SIGUSR1, handler);
+
+  kill (getpid(), SIGUSR1);
+  kill (getpid(), SIGUSR1);
+
+  if (sig == 2)
+    exit (0);
+  exit (1);
+}],[AC_MSG_RESULT([no])],[
+    AC_MSG_RESULT([yes])
+    AC_DEFINE(SIGNAL_RESET_TO_SIG_DFL, 1,
+        [Define to 1 if signal handler is set to SIG_DFL after signal])])
+
 # Check if <sys/select.h> needs to be included for fd_set
 AC_MSG_CHECKING([for fd_set])
 AC_TRY_COMPILE([#include <sys/types.h>],
