]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Set close-on-exec if possible.
authorTed Lemon <source@isc.org>
Wed, 5 Jan 2000 18:01:41 +0000 (18:01 +0000)
committerTed Lemon <source@isc.org>
Wed, 5 Jan 2000 18:01:41 +0000 (18:01 +0000)
common/dns.c
common/icmp.c

index 7b8df0a1f770fba7b1e711612846fd7f38084fd7..97e9af47b855d266806cd419ba20f9f1d934c92f 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dns.c,v 1.12 1999/10/07 06:35:41 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dns.c,v 1.13 2000/01/05 18:00:51 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -65,6 +65,11 @@ void dns_startup ()
        if (dns_protocol_fd < 0)
                log_fatal ("unable to create dns socket: %m");
 
+#if defined (HAVE_SETFD)
+       if (fcntl (dns_protocol_fd, F_SETFD, 1) < 0)
+               log_fatal ("unable to set close-on-exec on dns fd: %m");
+#endif
+
        first_name_server ();
 
        add_protocol ("dns", dns_protocol_fd, dns_packet, 0);
index 62c83b3757f012c586c488b1d324050e3859158c..8265460bb627f0a529e2ae297b6aa41dc4050cc2 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: icmp.c,v 1.15 1999/09/09 23:26:12 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: icmp.c,v 1.16 2000/01/05 18:01:41 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -83,6 +83,11 @@ void icmp_startup (routep, handler)
        if (new -> socket < 0)
                log_fatal ("unable to create icmp socket: %m");
 
+#if defined (HAVE_SETFD)
+       if (fcntl (new -> socket, F_SETFD, 1) < 0)
+               log_error ("Can't set close-on-exec on icmp socket: %m");
+#endif
+
        /* Make sure it does routing... */
        state = 0;
        if (setsockopt (new -> socket, SOL_SOCKET, SO_DONTROUTE,