philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/dhcp-handle_ctx_signals.patch

26a25c
diff --git a/omapip/isclib.c b/omapip/isclib.c
26a25c
index 9ec1a0f..42d82ff 100644
26a25c
--- a/omapip/isclib.c
26a25c
+++ b/omapip/isclib.c
26a25c
@@ -185,16 +185,6 @@ dhcp_context_create(int flags,
26a25c
 		if (result != ISC_R_SUCCESS)
26a25c
 			goto cleanup;
26a25c
 
26a25c
-		result = isc_app_ctxstart(dhcp_gbl_ctx.actx);
26a25c
-		if (result != ISC_R_SUCCESS)
26a25c
-			return (result);
26a25c
-		dhcp_gbl_ctx.actx_started = ISC_TRUE;
26a25c
-
26a25c
-		/* Not all OSs support suppressing SIGPIPE through socket
26a25c
-		 * options, so set the sigal action to be ignore.  This allows
26a25c
-		 * broken connections to fail gracefully with EPIPE on writes */
26a25c
-		handle_signal(SIGPIPE, SIG_IGN);
26a25c
-
26a25c
 		result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx,
26a25c
 						 dhcp_gbl_ctx.actx,
26a25c
 						 1, 0,
26a25c
@@ -217,6 +207,21 @@ dhcp_context_create(int flags,
26a25c
 		result = isc_task_create(dhcp_gbl_ctx.taskmgr, 0, &dhcp_gbl_ctx.task);
26a25c
 		if (result != ISC_R_SUCCESS)
26a25c
 			goto cleanup;
26a25c
+
26a25c
+		result = isc_app_ctxstart(dhcp_gbl_ctx.actx);
26a25c
+		if (result != ISC_R_SUCCESS)
26a25c
+			return (result);
26a25c
+		dhcp_gbl_ctx.actx_started = ISC_TRUE;
26a25c
+
26a25c
+		/* Not all OSs support suppressing SIGPIPE through socket
26a25c
+		 * options, so set the sigal action to be ignore.  This allows
26a25c
+		 * broken connections to fail gracefully with EPIPE on writes */
26a25c
+		handle_signal(SIGPIPE, SIG_IGN);
26a25c
+
26a25c
+		/* Reset handlers installed by isc_app_ctxstart()
26a25c
+		 * to default for control-c and kill */
26a25c
+		handle_signal(SIGINT, SIG_DFL);
26a25c
+		handle_signal(SIGTERM, SIG_DFL);
26a25c
 	}
26a25c
 
26a25c
 #if defined (NSUPDATE)
26a25c