summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2011-12-10 17:36:41 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2011-12-10 17:36:41 +0000
commit307923071e1eb557f27b19f1d1ec1a9af04684d1 (patch)
treed96c235fef1f3246c937f3d36b2c8200b2a16b90 /sbin/dhclient
parent16f9b8704f54503c072e356de64cb59f4b801526 (diff)
Try harder to re-initialize parsing state so nothing accidentally
carries over when a new file (i.e. leases after config) is parsed. May help with mysterious "Corrupt lease file" messages.
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/conflex.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c
index db3377aaba4..2eed7ac9cb8 100644
--- a/sbin/dhclient/conflex.c
+++ b/sbin/dhclient/conflex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conflex.c,v 1.13 2006/12/17 17:41:56 stevesk Exp $ */
+/* $OpenBSD: conflex.c,v 1.14 2011/12/10 17:36:40 krw Exp $ */
/* Lexical scanner for dhclient config file... */
@@ -74,12 +74,25 @@ static int intern(char *, int);
void
new_parse(char *name)
{
- tlname = name;
+ /*
+ * Initialize all parsing state, as we are starting to parse a
+ * new file, 'name'.
+ */
+
+ bzero(line1, sizeof(line1));
+ bzero(line2, sizeof(line2));
+ bzero(tokbuf, sizeof(tokbuf));
+
lpos = line = 1;
+ tlpos = tline = token = ugflag = 0;
+ tval = NULL;
+
+ lexline = lexchar = 0;
cur_line = line1;
prev_line = line2;
token_line = cur_line;
- cur_line[0] = prev_line[0] = 0;
+ tlname = name;
+
warnings_occurred = 0;
}