mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-31 14:25:41 +00:00
Use close-on-exec if available.
This commit is contained in:
@@ -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,
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user