From: Ted Lemon Date: Wed, 5 Jan 2000 18:10:59 +0000 (+0000) Subject: Use close-on-exec if available. X-Git-Tag: V3-BETA-2-PATCH-1~468 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=892aa61aa4b9168e4367ac407ff4666745f0335c;p=thirdparty%2Fdhcp.git Use close-on-exec if available. --- diff --git a/omapip/connection.c b/omapip/connection.c index 78a700187..41ca2bf72 100644 --- a/omapip/connection.c +++ b/omapip/connection.c @@ -93,6 +93,15 @@ isc_result_t omapi_connect (omapi_object_t *c, return ISC_R_UNEXPECTED; } +#if defined (HAVE_SETFD) + if (fcntl (obj -> socket, F_SETFD, 1) < 0) { + close (obj -> socket); + omapi_object_dereference ((omapi_object_t **)&obj, + "omapi_connect"); + return ISC_R_UNEXPECTED; + } +#endif + /* Set the SO_REUSEADDR flag (this should not fail). */ flag = 1; if (setsockopt (obj -> socket, SOL_SOCKET, SO_REUSEADDR, diff --git a/omapip/listener.c b/omapip/listener.c index cdb54a587..dba434a69 100644 --- a/omapip/listener.c +++ b/omapip/listener.c @@ -69,6 +69,15 @@ isc_result_t omapi_listen (omapi_object_t *h, return ISC_R_UNEXPECTED; } +#if defined (HAVE_SETFD) + if (fcntl (obj -> socket, F_SETFD, 1) < 0) { + close (obj -> socket); + omapi_object_dereference ((omapi_object_t **)&obj, + "omapi_listen"); + return ISC_R_UNEXPECTED; + } +#endif + /* Try to bind to the wildcard address using the port number we were given. */ if (bind (obj -> socket,