summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-05-05 13:21:50 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-05-05 13:21:50 +0000
commit661fbef569a963fdd4215da5fafe9b3013723162 (patch)
tree457f658ae29fccafe75ac2ddc159d75835fb1df3
parent327954f0bec9d235ca0646d40fa0cbca651be5be (diff)
open the lease file after the priv child was forked off so it doesn't have
a copy of this fd
-rw-r--r--sbin/dhclient/dhclient.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 9bef3ecb843..bcdb87749c7 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.44 2004/05/05 11:40:46 henning Exp $ */
+/* $OpenBSD: dhclient.c,v 1.45 2004/05/05 13:21:49 henning Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -264,11 +264,6 @@ main(int argc, char *argv[])
inaddr_any.s_addr = INADDR_ANY;
read_client_conf();
- if ((fd = open(path_dhclient_db, O_RDONLY|O_EXLOCK|O_CREAT, 0)) == -1)
- error("can't open and lock %s: %m", path_dhclient_db);
- read_client_leases();
- rewrite_client_leases();
- close(fd);
if (!interface_link_status(ifi->name)) {
fprintf(stderr, "%s: no link ", ifi->name);
@@ -297,6 +292,12 @@ main(int argc, char *argv[])
close(pipe_fd[0]);
privfd = pipe_fd[1];
+ if ((fd = open(path_dhclient_db, O_RDONLY|O_EXLOCK|O_CREAT, 0)) == -1)
+ error("can't open and lock %s: %m", path_dhclient_db);
+ read_client_leases();
+ rewrite_client_leases();
+ close(fd);
+
priv_script_init("PREINIT", NULL);
if (ifi->client->alias)
priv_script_write_params("alias_", ifi->client->alias);