diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-08-05 16:22:01 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-08-05 16:22:01 +0000 |
commit | e8cd42c22d97acb90bab8e7f274b9497782f1574 (patch) | |
tree | 43523a07e563c0d35230332b69722e42d31c9a8d /sbin | |
parent | dac1e33eb660e259de0356da6c311fbe11aa8d49 (diff) |
dhclient.leases(5) is not required for dhclient(8) to work, so just
carry on if it can't be accessed. e.g. if /var/db is not present in
single user mode.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/dhclient.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 0b125209a2c..b44897d2d8e 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.649 2019/08/05 15:20:29 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.650 2019/08/05 16:22:00 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -613,10 +613,8 @@ main(int argc, char *argv[]) fatal("setsockopt(ROUTE_TABLEFILTER)"); fd = take_charge(ifi, routefd, path_lease_db); - if (fd == -1) - fatalx("failed to take charge"); - - read_lease_db(&ifi->lease_db); + if (fd != -1) + read_lease_db(&ifi->lease_db); if ((leaseFile = fopen(path_lease_db, "w")) == NULL) log_warn("%s: fopen(%s)", log_procname, path_lease_db); @@ -2485,7 +2483,7 @@ take_charge(struct interface_info *ifi, int routefd, char *leasespath) if (time(&cur_time) == -1) fatal("time"); if (cur_time - start_time >= MAXSECONDS) - break; + fatalx("failed to take charge"); if ((ifi->flags & IFI_IN_CHARGE) == 0) { if ((cur_time - sent_time) >= SENTSECONDS) { @@ -2514,7 +2512,7 @@ take_charge(struct interface_info *ifi, int routefd, char *leasespath) fd = open(leasespath, O_NONBLOCK | O_RDONLY|O_EXLOCK|O_CREAT|O_NOFOLLOW, 0640); if (fd == -1 && errno != EWOULDBLOCK) - fatal("open(%s)", leasespath); + break; } } |