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

index b2b9d935a6cb53989416898511c097a2d5710730..cc68e05e06fc2d8bbfd1ce3fb5eeb4b9e2e28777 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -138,6 +138,13 @@ 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.0b2
 
 - Add declaration for variable in debug code in alloc.c.  [ISC-Bugs #21472]
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,