[glib/wip/gmain: 8/8] gspawn: Reset signal handlers for synchronous spawning



commit 288cca3f482d243dd377f0f9e86f877d7a2a3afe
Author: Colin Walters <walters verbum org>
Date:   Fri Jun 10 10:48:07 2011 -0400

    gspawn: Reset signal handlers for synchronous spawning
    
    We should by default reset signal handlers; particularly with the
    ability to install them via g_unix_signal_source_new(), we don't
    want to call a user callback inside a fork()ed helper process.

 glib/gspawn.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/glib/gspawn.c b/glib/gspawn.c
index e05de04..ca0c7ba 100644
--- a/glib/gspawn.c
+++ b/glib/gspawn.c
@@ -1238,6 +1238,12 @@ fork_exec_with_pipes (gboolean              intermediate_child,
       /* Immediate child. This may or may not be the child that
        * actually execs the new process.
        */
+
+      /* Reset some signal handlers that we may use */
+      signal (SIGCHLD, SIG_DFL);
+      signal (SIGINT, SIG_DFL);
+      signal (SIGTERM, SIG_DFL);
+      signal (SIGHUP, SIG_DFL);
       
       /* Be sure we crash if the parent exits
        * and we write to the err_report_pipe



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