Commit f7c83eb4 authored by Ted Lemon's avatar Ted Lemon
Browse files

Set close-on-exec if possible.

parent 31730f17
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment