Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
dhcp
0015-Ignore-SIGPIPE-to-not-die-in-socket-code.p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch of Package dhcp
From d9b443ef38da92bd325f5118a2a6ddc21fae098e Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski <mt@suse.de> Date: Thu, 20 Dec 2012 10:25:53 +0100 Subject: [PATCH] Ignore SIGPIPE to not die in socket code Installed SIG_IGN handler for SIGPIPE to not die before the errno==EPIPE checks in the socket code are reached. Unlike isc_app_start(), the isc_app_ctxstart() used by dhcp, does not set any signal handlers. Reported upstream as [ISC-Bugs #32222], IMO regression to [ISC-Bugs #22269] as the SO_NOSIGPIPE socket option isn't available e.g. on Linux. --- omapip/isclib.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/omapip/isclib.c b/omapip/isclib.c index afab262..9b7ff5f 100644 --- a/omapip/isclib.c +++ b/omapip/isclib.c @@ -69,6 +69,23 @@ isclib_cleanup(void) return; } +static isc_result_t +handle_signal(int sig, void (*handler)(int)) { + struct sigaction sa; + + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = handler; + + if (sigfillset(&sa.sa_mask) != 0 || + sigaction(sig, &sa, NULL) < 0) { + log_error("handle_signal() %d setup: %s", + sig, strerror(errno)); + return (ISC_R_UNEXPECTED); + } + + return (ISC_R_SUCCESS); +} + isc_result_t dhcp_context_create(void) { isc_result_t result; @@ -106,7 +123,20 @@ dhcp_context_create(void) { result = isc_app_ctxstart(dhcp_gbl_ctx.actx); if (result != ISC_R_SUCCESS) - return (result); + goto cleanup; + + /* + * Always ignore SIGPIPE. + * Otherwise we will die before the errno == EPIPE + * checks in the socket code are reached. + * + * Note: unlike isc_app_start(), isc_app_ctxstart() + * does not set any signal handlers. + */ + result = handle_signal(SIGPIPE, SIG_IGN); + if (result != ISC_R_SUCCESS) + goto cleanup; + dhcp_gbl_ctx.actx_started = ISC_TRUE; result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx, -- 1.8.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor