Commit 08d888b9 authored by Simon Marlow's avatar Simon Marlow
Browse files

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().
parent d9064fb5
......@@ -470,6 +470,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.
*
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment