2014-02-10 19:14:12 +01:00
|
|
|
From d9b443ef38da92bd325f5118a2a6ddc21fae098e Mon Sep 17 00:00:00 2001
|
2013-01-11 12:58:29 +01:00
|
|
|
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.
|
|
|
|
---
|
2014-02-10 19:14:12 +01:00
|
|
|
omapip/isclib.c | 32 +++++++++++++++++++++++++++++++-
|
|
|
|
1 file changed, 31 insertions(+), 1 deletion(-)
|
2013-01-11 12:58:29 +01:00
|
|
|
|
|
|
|
diff --git a/omapip/isclib.c b/omapip/isclib.c
|
2014-02-10 19:14:12 +01:00
|
|
|
index afab262..9b7ff5f 100644
|
2013-01-11 12:58:29 +01:00
|
|
|
--- a/omapip/isclib.c
|
|
|
|
+++ b/omapip/isclib.c
|
2014-02-10 19:14:12 +01:00
|
|
|
@@ -69,6 +69,23 @@ isclib_cleanup(void)
|
2013-01-11 12:58:29 +01:00
|
|
|
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;
|
2014-02-10 19:14:12 +01:00
|
|
|
@@ -106,7 +123,20 @@ dhcp_context_create(void) {
|
2013-01-11 12:58:29 +01:00
|
|
|
|
|
|
|
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,
|
|
|
|
--
|
2014-02-10 19:14:12 +01:00
|
|
|
1.8.4
|
2013-01-11 12:58:29 +01:00
|
|
|
|