diff options
author | Simon Marlow <marlowsd@gmail.com> | 2010-09-25 19:35:48 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2010-09-25 19:35:48 +0000 |
commit | 08d888b90c82b3aa3092e439b197cef939ed3d44 (patch) | |
tree | e5e0fd74329dfc27a143368be7f8517a0521efe6 /rts | |
parent | d9064fb552f84ba7a642bb94cf306e1be87a236c (diff) | |
download | haskell-08d888b90c82b3aa3092e439b197cef939ed3d44.tar.gz |
Use an empty signal handler for SIGPIPE instead of SIG_IGN
This is so that the SIGPIPE handler gets reset to the default
automatically on exec().
Diffstat (limited to 'rts')
-rw-r--r-- | rts/posix/Signals.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index b045289ce6..e723b8ff0a 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -471,6 +471,15 @@ shutdown_handler(int sig STG_UNUSED) } /* ----------------------------------------------------------------------------- + * An empty signal handler, currently used for SIGPIPE + * -------------------------------------------------------------------------- */ +static void +empty_handler (int sig STG_UNUSED) +{ + // nothing +} + +/* ----------------------------------------------------------------------------- * Install default signal handlers. * * The RTS installs a default signal handler for catching @@ -526,7 +535,9 @@ initDefaultHandlers(void) #endif // ignore SIGPIPE; see #1619 - action.sa_handler = SIG_IGN; + // actually, we use an empty signal handler rather than SIG_IGN, + // so that SIGPIPE gets reset to its default behaviour on exec. + action.sa_handler = empty_handler; sigemptyset(&action.sa_mask); action.sa_flags = 0; if (sigaction(SIGPIPE, &action, &oact) != 0) { |