diff options
author | 2011-12-10 17:36:40 +0000 | |
---|---|---|
committer | 2011-12-10 17:36:40 +0000 | |
commit | 4b521c712bf5dbd1a8a8ea6f37f76a9c8738a2a6 (patch) | |
tree | 8665e17174c707def6243fd72d8b0e126837d3dc | |
parent | Tweak parsing. No need to declare, assign and then ignore the token (diff) | |
download | wireguard-openbsd-4b521c712bf5dbd1a8a8ea6f37f76a9c8738a2a6.tar.xz wireguard-openbsd-4b521c712bf5dbd1a8a8ea6f37f76a9c8738a2a6.zip |
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.
-rw-r--r-- | sbin/dhclient/conflex.c | 19 |
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; } |