summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-07-04 23:33:50 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-07-04 23:33:50 +0000
commit19a36f730dd58a4d1670fea2d96e2ea0d8b64924 (patch)
tree7f4044dc60de379d102da238e400189c5a1a3015
parentbc68cbda44470cd3e19cae463b3104209b9177dd (diff)
properly bitch when we cannot open the config file, basically resembling
a diff from Damir Horvat <damir@x-si.org> which didn't apply cleanly
-rw-r--r--sbin/dhclient/clparse.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index 2fec87b6593..ab631b24d5d 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clparse.c,v 1.15 2004/05/13 07:35:17 wilfried Exp $ */
+/* $OpenBSD: clparse.c,v 1.16 2004/07/04 23:33:49 henning Exp $ */
/* Parser for dhclient config and lease files... */
@@ -96,16 +96,18 @@ read_client_conf(void)
top_level_config.requested_options
[top_level_config.requested_option_count++] = DHO_HOST_NAME;
- if ((cfile = fopen(path_dhclient_conf, "r")) != NULL) {
- do {
- token = peek_token(&val, cfile);
- if (token == EOF)
- break;
- parse_client_statement(cfile, NULL, &top_level_config);
- } while (1);
- token = next_token(&val, cfile); /* Clear the peek buffer */
- fclose(cfile);
- }
+ if ((cfile = fopen(path_dhclient_conf, "r")) == NULL)
+ error("can't open config file %s: %m",
+ path_dhclient_conf);
+
+ do {
+ token = peek_token(&val, cfile);
+ if (token == EOF)
+ break;
+ parse_client_statement(cfile, NULL, &top_level_config);
+ } while (1);
+ token = next_token(&val, cfile); /* Clear the peek buffer */
+ fclose(cfile);
/*
* Set up state and config structures for clients that don't