diff options
author | Thomas Markwalder <tmark@isc.org> | 2014-11-05 07:31:17 -0500 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2014-11-05 07:31:17 -0500 |
commit | 6067cd48daa03514267859ca4b52fa0dc57dfc74 (patch) | |
tree | 417d87389ef3cd00094468c04f886cfd705b093a /omapip/isclib.c | |
parent | f542e92b7ba9353ab6a13d8d006621affedf1211 (diff) | |
download | isc-dhcp-6067cd48daa03514267859ca4b52fa0dc57dfc74.tar.gz |
[master] Set signal action to ingore for SIGPIPE
Merges in rt32222.
Diffstat (limited to 'omapip/isclib.c')
-rw-r--r-- | omapip/isclib.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/omapip/isclib.c b/omapip/isclib.c index 3e5e1c2b..13f0d3eb 100644 --- a/omapip/isclib.c +++ b/omapip/isclib.c @@ -120,6 +120,20 @@ isclib_cleanup(void) return; } +/* Installs a handler for a signal using sigaction */ +static void +handle_signal(int sig, void (*handler)(int)) { + struct sigaction sa; + + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = handler; + sigfillset(&sa.sa_mask); + if (sigaction(sig, &sa, NULL) != 0) { + log_debug("handle_signal() failed for signal %d error: %s", + sig, strerror(errno)); + } +} + isc_result_t dhcp_context_create(int flags, struct in_addr *local4, @@ -176,6 +190,11 @@ dhcp_context_create(int flags, return (result); dhcp_gbl_ctx.actx_started = ISC_TRUE; + /* Not all OSs support suppressing SIGPIPE through socket + * options, so set the sigal action to be ignore. This allows + * broken connections to fail gracefully with EPIPE on writes */ + handle_signal(SIGPIPE, SIG_IGN); + result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx, dhcp_gbl_ctx.actx, 1, 0, |