From: Shawn Routhier Date: Thu, 18 Nov 2010 19:47:36 +0000 (+0000) Subject: Ignore sigpipe if possible. 22269 X-Git-Tag: v4_3_0a1~234 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3004babab17a9388f603963cdf1d0577536c7c1a;p=thirdparty%2Fdhcp.git Ignore sigpipe if possible. 22269 --- diff --git a/RELNOTES b/RELNOTES index b2b9d935a..cc68e05e0 100644 --- 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] 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,