]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Ignore sigpipe. #22269
authorShawn Routhier <sar@isc.org>
Thu, 18 Nov 2010 19:53:32 +0000 (19:53 +0000)
committerShawn Routhier <sar@isc.org>
Thu, 18 Nov 2010 19:53:32 +0000 (19:53 +0000)
RELNOTES
omapip/connection.c

index ac1780c8f2c49a105f83c8c8bc92d327e50b67a3..0a92d7182537ebb3b15f1fd213969c2d5538e677 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -128,6 +128,12 @@ work on other platforms. Please report any problems and suggested fixes to
   This fixes a bug where 'dhclient' would have shared library dependencies
   on '/usr/lib'.  [ISC-Bugs #21967]
 
+- Handle pipe failures more gracefully.  Some OSes pass a SIGPIPE
+  signal to a process and will kill the process if the signal isn't
+  caught.  This patch adds code to turn off the SIGPIPE signal via
+  a setsockopt() call.  The signal is already being ignored as part
+  of the ISC library.  [ISC-Bugs #22269]
+
                        Changes since 4.2.0rc1
 
 - Documentation cleanup covering multiple tickets
index ffbb0437227bf6916c6f8865e5f1e3243e001ad1..4948070a9c57ba3f027f274e57b68ec948719d1f 100644 (file)
@@ -208,6 +208,19 @@ isc_result_t omapi_connect_list (omapi_object_t *c,
                        return ISC_R_UNEXPECTED;
                }
 
+#ifdef SO_NOSIGPIPE
+               /*
+                * If available stop the OS from killing our
+                * program on a SIGPIPE failure
+                */
+               flag = 1;
+               if (setsockopt(obj->socket, SOL_SOCKET, SO_NOSIGPIPE,
+                              (char *)&flag, sizeof(flag)) < 0) {
+                       omapi_connection_dereference (&obj, MDL);
+                       return ISC_R_UNEXPECTED;
+               }                       
+#endif
+
                status = (omapi_register_io_object
                          ((omapi_object_t *)obj,
                           0, omapi_connection_writefd,