]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Use close-on-exec if available.
authorTed Lemon <source@isc.org>
Wed, 5 Jan 2000 18:10:59 +0000 (18:10 +0000)
committerTed Lemon <source@isc.org>
Wed, 5 Jan 2000 18:10:59 +0000 (18:10 +0000)
omapip/connection.c
omapip/listener.c

index 78a700187f9d5747f08f09c1ae87dee77acb148b..41ca2bf72699f66be57c45357c8356b406205f8f 100644 (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,
index cdb54a587a48fd0f91d049a3a14f6c27df0dbaae..dba434a693e532dd665f7344cacb0726e3274e79 100644 (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,