From: Shawn Routhier Date: Thu, 18 Nov 2010 19:53:32 +0000 (+0000) Subject: Ignore sigpipe. #22269 X-Git-Tag: v4_2_1b1~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0215332867f284174fb6029751a0a86b42d1988c;p=thirdparty%2Fdhcp.git Ignore sigpipe. #22269 --- diff --git a/RELNOTES b/RELNOTES index ac1780c8f..0a92d7182 100644 --- 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 diff --git a/omapip/connection.c b/omapip/connection.c index ffbb04372..4948070a9 100644 --- a/omapip/connection.c +++ b/omapip/connection.c @@ -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,