From: Antonio Huete Jimenez Date: Sat, 4 Aug 2012 18:55:19 +0000 (+0200) Subject: dhclient - Try harder to re-initialize parsing state. X-Git-Tag: v3.2.0~324 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/8bd3111e4cda790603d42ecc5505a5c6a6c42d48?ds=sidebyside dhclient - Try harder to re-initialize parsing state. - Attempt that nothing accidentally carries over when a new file (i.e. leases after config) is parsed. May help with mysterious "Corrupt lease file" messages. Taken-from: OpenBSD --- diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index a4698e15ac..fc988e3ded 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -1,5 +1,4 @@ -/* $OpenBSD: conflex.c,v 1.13 2006/12/17 17:41:56 stevesk Exp $ */ -/* $DragonFly: src/sbin/dhclient/conflex.c,v 1.1 2008/08/30 16:07:58 hasso Exp $ */ +/* $OpenBSD: src/sbin/dhclient/conflex.c,v 1.14 2011/12/10 17:36:40 krw Exp $ */ /* Lexical scanner for dhclient config file... */ @@ -76,12 +75,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; }