|
|
54343e |
diff -up dhcp-4.2.2b1/client/clparse.c.cloexec dhcp-4.2.2b1/client/clparse.c
|
|
|
54343e |
--- dhcp-4.2.2b1/client/clparse.c.cloexec 2011-07-01 14:13:30.973887714 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/client/clparse.c 2011-07-01 14:15:15.021580693 +0200
|
|
|
54343e |
@@ -246,7 +246,7 @@ int read_client_conf_file (const char *n
|
|
|
54343e |
int token;
|
|
|
54343e |
isc_result_t status;
|
|
|
54343e |
|
|
|
54343e |
- if ((file = open (name, O_RDONLY)) < 0)
|
|
|
54343e |
+ if ((file = open (name, O_RDONLY | O_CLOEXEC)) < 0)
|
|
|
54343e |
return uerr2isc (errno);
|
|
|
54343e |
|
|
|
54343e |
cfile = NULL;
|
|
|
54343e |
@@ -283,7 +283,7 @@ void read_client_leases ()
|
|
|
54343e |
|
|
|
54343e |
/* Open the lease file. If we can't open it, just return -
|
|
|
54343e |
we can safely trust the server to remember our state. */
|
|
|
54343e |
- if ((file = open (path_dhclient_db, O_RDONLY)) < 0)
|
|
|
54343e |
+ if ((file = open (path_dhclient_db, O_RDONLY | O_CLOEXEC)) < 0)
|
|
|
54343e |
return;
|
|
|
54343e |
|
|
|
54343e |
cfile = NULL;
|
|
|
54343e |
diff -up dhcp-4.2.2b1/client/dhclient.c.cloexec dhcp-4.2.2b1/client/dhclient.c
|
|
|
54343e |
--- dhcp-4.2.2b1/client/dhclient.c.cloexec 2011-07-01 14:13:30.970887717 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/client/dhclient.c 2011-07-01 14:16:51.485930388 +0200
|
|
|
54343e |
@@ -148,11 +148,11 @@ main(int argc, char **argv) {
|
|
|
54343e |
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and
|
|
|
54343e |
2 (stderr) are open. To do this, we assume that when we
|
|
|
54343e |
open a file the lowest available file descriptor is used. */
|
|
|
54343e |
- fd = open("/dev/null", O_RDWR);
|
|
|
54343e |
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (fd == 0)
|
|
|
54343e |
- fd = open("/dev/null", O_RDWR);
|
|
|
54343e |
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (fd == 1)
|
|
|
54343e |
- fd = open("/dev/null", O_RDWR);
|
|
|
54343e |
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (fd == 2)
|
|
|
54343e |
log_perror = 0; /* No sense logging to /dev/null. */
|
|
|
54343e |
else if (fd != -1)
|
|
|
54343e |
@@ -506,7 +506,7 @@ main(int argc, char **argv) {
|
|
|
54343e |
int e;
|
|
|
54343e |
|
|
|
54343e |
oldpid = 0;
|
|
|
54343e |
- if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) {
|
|
|
54343e |
+ if ((pidfd = fopen(path_dhclient_pid, "re")) != NULL) {
|
|
|
54343e |
e = fscanf(pidfd, "%ld\n", &temp);
|
|
|
54343e |
oldpid = (pid_t)temp;
|
|
|
54343e |
|
|
|
54343e |
@@ -548,7 +548,7 @@ main(int argc, char **argv) {
|
|
|
54343e |
strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx);
|
|
|
54343e |
sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name);
|
|
|
54343e |
|
|
|
54343e |
- if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) {
|
|
|
54343e |
+ if ((pidfd = fopen(new_path_dhclient_pid, "re")) != NULL) {
|
|
|
54343e |
e = fscanf(pidfd, "%ld\n", &temp);
|
|
|
54343e |
oldpid = (pid_t)temp;
|
|
|
54343e |
|
|
|
54343e |
@@ -573,7 +573,7 @@ main(int argc, char **argv) {
|
|
|
54343e |
int dhc_running = 0;
|
|
|
54343e |
char procfn[256] = "";
|
|
|
54343e |
|
|
|
54343e |
- if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) {
|
|
|
54343e |
+ if ((pidfp = fopen(path_dhclient_pid, "re")) != NULL) {
|
|
|
54343e |
if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) {
|
|
|
54343e |
snprintf(procfn,256,"/proc/%u",dhcpid);
|
|
|
54343e |
dhc_running = (access(procfn, F_OK) == 0);
|
|
|
54343e |
@@ -2995,7 +2995,7 @@ void rewrite_client_leases ()
|
|
|
54343e |
|
|
|
54343e |
if (leaseFile != NULL)
|
|
|
54343e |
fclose (leaseFile);
|
|
|
54343e |
- leaseFile = fopen (path_dhclient_db, "w");
|
|
|
54343e |
+ leaseFile = fopen (path_dhclient_db, "we");
|
|
|
54343e |
if (leaseFile == NULL) {
|
|
|
54343e |
log_error ("can't create %s: %m", path_dhclient_db);
|
|
|
54343e |
return;
|
|
|
54343e |
@@ -3105,7 +3105,7 @@ write_duid(struct data_string *duid)
|
|
|
54343e |
return DHCP_R_INVALIDARG;
|
|
|
54343e |
|
|
|
54343e |
if (leaseFile == NULL) { /* XXX? */
|
|
|
54343e |
- leaseFile = fopen(path_dhclient_db, "w");
|
|
|
54343e |
+ leaseFile = fopen(path_dhclient_db, "we");
|
|
|
54343e |
if (leaseFile == NULL) {
|
|
|
54343e |
log_error("can't create %s: %m", path_dhclient_db);
|
|
|
54343e |
return ISC_R_IOERROR;
|
|
|
54343e |
@@ -3285,7 +3285,7 @@ int write_client_lease (client, lease, r
|
|
|
54343e |
return 1;
|
|
|
54343e |
|
|
|
54343e |
if (leaseFile == NULL) { /* XXX */
|
|
|
54343e |
- leaseFile = fopen (path_dhclient_db, "w");
|
|
|
54343e |
+ leaseFile = fopen (path_dhclient_db, "we");
|
|
|
54343e |
if (leaseFile == NULL) {
|
|
|
54343e |
log_error ("can't create %s: %m", path_dhclient_db);
|
|
|
54343e |
return 0;
|
|
|
54343e |
@@ -3772,9 +3772,9 @@ void go_daemon ()
|
|
|
54343e |
close(2);
|
|
|
54343e |
|
|
|
54343e |
/* Reopen them on /dev/null. */
|
|
|
54343e |
- open("/dev/null", O_RDWR);
|
|
|
54343e |
- open("/dev/null", O_RDWR);
|
|
|
54343e |
- open("/dev/null", O_RDWR);
|
|
|
54343e |
+ open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
+ open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
+ open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
|
|
|
54343e |
write_client_pid_file ();
|
|
|
54343e |
|
|
|
54343e |
@@ -3791,14 +3791,14 @@ void write_client_pid_file ()
|
|
|
54343e |
return;
|
|
|
54343e |
}
|
|
|
54343e |
|
|
|
54343e |
- pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY, 0644);
|
|
|
54343e |
+ pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644);
|
|
|
54343e |
|
|
|
54343e |
if (pfdesc < 0) {
|
|
|
54343e |
log_error ("Can't create %s: %m", path_dhclient_pid);
|
|
|
54343e |
return;
|
|
|
54343e |
}
|
|
|
54343e |
|
|
|
54343e |
- pf = fdopen (pfdesc, "w");
|
|
|
54343e |
+ pf = fdopen (pfdesc, "we");
|
|
|
54343e |
if (!pf) {
|
|
|
54343e |
close(pfdesc);
|
|
|
54343e |
log_error ("Can't fdopen %s: %m", path_dhclient_pid);
|
|
|
54343e |
diff -up dhcp-4.2.2b1/common/bpf.c.cloexec dhcp-4.2.2b1/common/bpf.c
|
|
|
54343e |
--- dhcp-4.2.2b1/common/bpf.c.cloexec 2011-07-01 14:13:30.976887712 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/common/bpf.c 2011-07-01 14:13:31.030887673 +0200
|
|
|
54343e |
@@ -94,7 +94,7 @@ int if_register_bpf (info)
|
|
|
54343e |
for (b = 0; 1; b++) {
|
|
|
54343e |
/* %Audit% 31 bytes max. %2004.06.17,Safe% */
|
|
|
54343e |
sprintf(filename, BPF_FORMAT, b);
|
|
|
54343e |
- sock = open (filename, O_RDWR, 0);
|
|
|
54343e |
+ sock = open (filename, O_RDWR | O_CLOEXEC, 0);
|
|
|
54343e |
if (sock < 0) {
|
|
|
54343e |
if (errno == EBUSY) {
|
|
|
54343e |
continue;
|
|
|
54343e |
diff -up dhcp-4.2.2b1/common/dlpi.c.cloexec dhcp-4.2.2b1/common/dlpi.c
|
|
|
54343e |
--- dhcp-4.2.2b1/common/dlpi.c.cloexec 2011-07-01 14:13:30.977887712 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/common/dlpi.c 2011-07-01 14:13:31.032887673 +0200
|
|
|
54343e |
@@ -806,7 +806,7 @@ dlpiopen(const char *ifname) {
|
|
|
54343e |
}
|
|
|
54343e |
*dp = '\0';
|
|
|
54343e |
|
|
|
54343e |
- return open (devname, O_RDWR, 0);
|
|
|
54343e |
+ return open (devname, O_RDWR | O_CLOEXEC, 0);
|
|
|
54343e |
}
|
|
|
54343e |
|
|
|
54343e |
/*
|
|
|
54343e |
diff -up dhcp-4.2.2b1/common/nit.c.cloexec dhcp-4.2.2b1/common/nit.c
|
|
|
54343e |
--- dhcp-4.2.2b1/common/nit.c.cloexec 2011-07-01 14:13:30.978887712 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/common/nit.c 2011-07-01 14:13:31.033887672 +0200
|
|
|
54343e |
@@ -81,7 +81,7 @@ int if_register_nit (info)
|
|
|
54343e |
struct strioctl sio;
|
|
|
54343e |
|
|
|
54343e |
/* Open a NIT device */
|
|
|
54343e |
- sock = open ("/dev/nit", O_RDWR);
|
|
|
54343e |
+ sock = open ("/dev/nit", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (sock < 0)
|
|
|
54343e |
log_fatal ("Can't open NIT device for %s: %m", info -> name);
|
|
|
54343e |
|
|
|
54343e |
diff -up dhcp-4.2.2b1/common/resolv.c.cloexec dhcp-4.2.2b1/common/resolv.c
|
|
|
54343e |
--- dhcp-4.2.2b1/common/resolv.c.cloexec 2009-11-20 02:49:01.000000000 +0100
|
|
|
54343e |
+++ dhcp-4.2.2b1/common/resolv.c 2011-07-01 14:13:31.033887672 +0200
|
|
|
54343e |
@@ -49,7 +49,7 @@ void read_resolv_conf (parse_time)
|
|
|
54343e |
struct domain_search_list *dp, *dl, *nd;
|
|
|
54343e |
isc_result_t status;
|
|
|
54343e |
|
|
|
54343e |
- if ((file = open (path_resolv_conf, O_RDONLY)) < 0) {
|
|
|
54343e |
+ if ((file = open (path_resolv_conf, O_RDONLY | O_CLOEXEC)) < 0) {
|
|
|
54343e |
log_error ("Can't open %s: %m", path_resolv_conf);
|
|
|
54343e |
return;
|
|
|
54343e |
}
|
|
|
54343e |
diff -up dhcp-4.2.2b1/common/upf.c.cloexec dhcp-4.2.2b1/common/upf.c
|
|
|
54343e |
--- dhcp-4.2.2b1/common/upf.c.cloexec 2011-07-01 14:13:30.979887712 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/common/upf.c 2011-07-01 14:13:31.034887671 +0200
|
|
|
54343e |
@@ -77,7 +77,7 @@ int if_register_upf (info)
|
|
|
54343e |
/* %Audit% Cannot exceed 36 bytes. %2004.06.17,Safe% */
|
|
|
54343e |
sprintf(filename, "/dev/pf/pfilt%d", b);
|
|
|
54343e |
|
|
|
54343e |
- sock = open (filename, O_RDWR, 0);
|
|
|
54343e |
+ sock = open (filename, O_RDWR | O_CLOEXEC, 0);
|
|
|
54343e |
if (sock < 0) {
|
|
|
54343e |
if (errno == EBUSY) {
|
|
|
54343e |
continue;
|
|
|
54343e |
diff -up dhcp-4.2.2b1/omapip/trace.c.cloexec dhcp-4.2.2b1/omapip/trace.c
|
|
|
54343e |
--- dhcp-4.2.2b1/omapip/trace.c.cloexec 2010-05-27 02:34:57.000000000 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/omapip/trace.c 2011-07-01 14:13:31.036887669 +0200
|
|
|
54343e |
@@ -141,10 +141,10 @@ isc_result_t trace_begin (const char *fi
|
|
|
54343e |
return DHCP_R_INVALIDARG;
|
|
|
54343e |
}
|
|
|
54343e |
|
|
|
54343e |
- traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL, 0600);
|
|
|
54343e |
+ traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL | O_CLOEXEC, 0600);
|
|
|
54343e |
if (traceoutfile < 0 && errno == EEXIST) {
|
|
|
54343e |
log_error ("WARNING: Overwriting trace file \"%s\"", filename);
|
|
|
54343e |
- traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC,
|
|
|
54343e |
+ traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC | O_CLOEXEC,
|
|
|
54343e |
0600);
|
|
|
54343e |
}
|
|
|
54343e |
|
|
|
54343e |
@@ -431,7 +431,7 @@ void trace_file_replay (const char *file
|
|
|
54343e |
isc_result_t result;
|
|
|
54343e |
int len;
|
|
|
54343e |
|
|
|
54343e |
- traceinfile = fopen (filename, "r");
|
|
|
54343e |
+ traceinfile = fopen (filename, "re");
|
|
|
54343e |
if (!traceinfile) {
|
|
|
54343e |
log_error("Can't open tracefile %s: %m", filename);
|
|
|
54343e |
return;
|
|
|
54343e |
diff -up dhcp-4.2.2b1/relay/dhcrelay.c.cloexec dhcp-4.2.2b1/relay/dhcrelay.c
|
|
|
54343e |
--- dhcp-4.2.2b1/relay/dhcrelay.c.cloexec 2011-05-10 15:07:37.000000000 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/relay/dhcrelay.c 2011-07-01 14:18:07.630209767 +0200
|
|
|
54343e |
@@ -183,11 +183,11 @@ main(int argc, char **argv) {
|
|
|
54343e |
/* Make sure that file descriptors 0(stdin), 1,(stdout), and
|
|
|
54343e |
2(stderr) are open. To do this, we assume that when we
|
|
|
54343e |
open a file the lowest available file descriptor is used. */
|
|
|
54343e |
- fd = open("/dev/null", O_RDWR);
|
|
|
54343e |
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (fd == 0)
|
|
|
54343e |
- fd = open("/dev/null", O_RDWR);
|
|
|
54343e |
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (fd == 1)
|
|
|
54343e |
- fd = open("/dev/null", O_RDWR);
|
|
|
54343e |
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (fd == 2)
|
|
|
54343e |
log_perror = 0; /* No sense logging to /dev/null. */
|
|
|
54343e |
else if (fd != -1)
|
|
|
54343e |
@@ -540,13 +540,13 @@ main(int argc, char **argv) {
|
|
|
54343e |
|
|
|
54343e |
if (no_pid_file == ISC_FALSE) {
|
|
|
54343e |
pfdesc = open(path_dhcrelay_pid,
|
|
|
54343e |
- O_CREAT | O_TRUNC | O_WRONLY, 0644);
|
|
|
54343e |
+ O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644);
|
|
|
54343e |
|
|
|
54343e |
if (pfdesc < 0) {
|
|
|
54343e |
log_error("Can't create %s: %m",
|
|
|
54343e |
path_dhcrelay_pid);
|
|
|
54343e |
} else {
|
|
|
54343e |
- pf = fdopen(pfdesc, "w");
|
|
|
54343e |
+ pf = fdopen(pfdesc, "we");
|
|
|
54343e |
if (!pf)
|
|
|
54343e |
log_error("Can't fdopen %s: %m",
|
|
|
54343e |
path_dhcrelay_pid);
|
|
|
54343e |
diff -up dhcp-4.2.2b1/server/confpars.c.cloexec dhcp-4.2.2b1/server/confpars.c
|
|
|
54343e |
--- dhcp-4.2.2b1/server/confpars.c.cloexec 2010-10-14 00:34:45.000000000 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/server/confpars.c 2011-07-01 14:13:31.039887666 +0200
|
|
|
54343e |
@@ -116,7 +116,7 @@ isc_result_t read_conf_file (const char
|
|
|
54343e |
}
|
|
|
54343e |
#endif
|
|
|
54343e |
|
|
|
54343e |
- if ((file = open (filename, O_RDONLY)) < 0) {
|
|
|
54343e |
+ if ((file = open (filename, O_RDONLY | O_CLOEXEC)) < 0) {
|
|
|
54343e |
if (leasep) {
|
|
|
54343e |
log_error ("Can't open lease database %s: %m --",
|
|
|
54343e |
path_dhcpd_db);
|
|
|
54343e |
diff -up dhcp-4.2.2b1/server/db.c.cloexec dhcp-4.2.2b1/server/db.c
|
|
|
54343e |
--- dhcp-4.2.2b1/server/db.c.cloexec 2010-09-14 00:15:26.000000000 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/server/db.c 2011-07-01 14:13:31.040887665 +0200
|
|
|
54343e |
@@ -1035,7 +1035,7 @@ void db_startup (testp)
|
|
|
54343e |
}
|
|
|
54343e |
#endif
|
|
|
54343e |
if (!testp) {
|
|
|
54343e |
- db_file = fopen (path_dhcpd_db, "a");
|
|
|
54343e |
+ db_file = fopen (path_dhcpd_db, "ae");
|
|
|
54343e |
if (!db_file)
|
|
|
54343e |
log_fatal ("Can't open %s for append.", path_dhcpd_db);
|
|
|
54343e |
expire_all_pools ();
|
|
|
54343e |
@@ -1083,12 +1083,12 @@ int new_lease_file ()
|
|
|
54343e |
path_dhcpd_db, (int)t) >= sizeof newfname)
|
|
|
54343e |
log_fatal("new_lease_file: lease file path too long");
|
|
|
54343e |
|
|
|
54343e |
- db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT, 0664);
|
|
|
54343e |
+ db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0664);
|
|
|
54343e |
if (db_fd < 0) {
|
|
|
54343e |
log_error ("Can't create new lease file: %m");
|
|
|
54343e |
return 0;
|
|
|
54343e |
}
|
|
|
54343e |
- if ((new_db_file = fdopen(db_fd, "w")) == NULL) {
|
|
|
54343e |
+ if ((new_db_file = fdopen(db_fd, "we")) == NULL) {
|
|
|
54343e |
log_error("Can't fdopen new lease file: %m");
|
|
|
54343e |
close(db_fd);
|
|
|
54343e |
goto fdfail;
|
|
|
54343e |
diff -up dhcp-4.2.2b1/server/dhcpd.c.cloexec dhcp-4.2.2b1/server/dhcpd.c
|
|
|
54343e |
--- dhcp-4.2.2b1/server/dhcpd.c.cloexec 2011-04-21 16:08:15.000000000 +0200
|
|
|
54343e |
+++ dhcp-4.2.2b1/server/dhcpd.c 2011-07-01 14:19:40.354124505 +0200
|
|
|
54343e |
@@ -270,11 +270,11 @@ main(int argc, char **argv) {
|
|
|
54343e |
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and
|
|
|
54343e |
2 (stderr) are open. To do this, we assume that when we
|
|
|
54343e |
open a file the lowest available file descriptor is used. */
|
|
|
54343e |
- fd = open("/dev/null", O_RDWR);
|
|
|
54343e |
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (fd == 0)
|
|
|
54343e |
- fd = open("/dev/null", O_RDWR);
|
|
|
54343e |
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (fd == 1)
|
|
|
54343e |
- fd = open("/dev/null", O_RDWR);
|
|
|
54343e |
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
if (fd == 2)
|
|
|
54343e |
log_perror = 0; /* No sense logging to /dev/null. */
|
|
|
54343e |
else if (fd != -1)
|
|
|
54343e |
@@ -793,7 +793,7 @@ main(int argc, char **argv) {
|
|
|
54343e |
*/
|
|
|
54343e |
if (no_pid_file == ISC_FALSE) {
|
|
|
54343e |
/*Read previous pid file. */
|
|
|
54343e |
- if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
|
|
|
54343e |
+ if ((i = open (path_dhcpd_pid, O_RDONLY | O_CLOEXEC)) >= 0) {
|
|
|
54343e |
status = read(i, pbuf, (sizeof pbuf) - 1);
|
|
|
54343e |
close (i);
|
|
|
54343e |
if (status > 0) {
|
|
|
54343e |
@@ -812,7 +812,7 @@ main(int argc, char **argv) {
|
|
|
54343e |
}
|
|
|
54343e |
|
|
|
54343e |
/* Write new pid file. */
|
|
|
54343e |
- i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC, 0644);
|
|
|
54343e |
+ i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644);
|
|
|
54343e |
if (i >= 0) {
|
|
|
54343e |
sprintf(pbuf, "%d\n", (int) getpid());
|
|
|
54343e |
IGNORE_RET (write(i, pbuf, strlen(pbuf)));
|
|
|
54343e |
@@ -840,9 +840,9 @@ main(int argc, char **argv) {
|
|
|
54343e |
close(2);
|
|
|
54343e |
|
|
|
54343e |
/* Reopen them on /dev/null. */
|
|
|
54343e |
- open("/dev/null", O_RDWR);
|
|
|
54343e |
- open("/dev/null", O_RDWR);
|
|
|
54343e |
- open("/dev/null", O_RDWR);
|
|
|
54343e |
+ open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
+ open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
+ open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
54343e |
log_perror = 0; /* No sense logging to /dev/null. */
|
|
|
54343e |
|
|
|
54343e |
IGNORE_RET (chdir("/"));
|
|
|
54343e |
diff -up dhcp-4.2.2b1/server/ldap.c.cloexec dhcp-4.2.2b1/server/ldap.c
|
|
|
54343e |
--- dhcp-4.2.2b1/server/ldap.c.cloexec 2010-03-25 16:26:58.000000000 +0100
|
|
|
54343e |
+++ dhcp-4.2.2b1/server/ldap.c 2011-07-01 14:13:31.043887665 +0200
|
|
|
54343e |
@@ -685,7 +685,7 @@ ldap_start (void)
|
|
|
54343e |
|
|
|
54343e |
if (ldap_debug_file != NULL && ldap_debug_fd == -1)
|
|
|
54343e |
{
|
|
|
54343e |
- if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY,
|
|
|
54343e |
+ if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC,
|
|
|
54343e |
S_IRUSR | S_IWUSR)) < 0)
|
|
|
54343e |
log_error ("Error opening debug LDAP log file %s: %s", ldap_debug_file,
|
|
|
54343e |
strerror (errno));
|