2
0
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:
Ted Lemon
2000-01-05 18:10:59 +00:00
parent 9a83b1d954
commit 892aa61aa4
2 changed files with 18 additions and 0 deletions

View File

@@ -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,

View File

@@ -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,