From e6555b046798b1900e93c3208d26301872f50ca5 Mon Sep 17 00:00:00 2001 From: Shane Kerr Date: Mon, 17 Sep 2007 09:56:29 +0000 Subject: [PATCH] Allow configuration files without a newline at the end now parse without error. Should allow Windows users to edit their configuration files with NOTEPAD.EXE, or other text editors that don't believe in a final newline. See RT ticket #17120 for more. --- CHANGES | 3 +++ lib/isc/lex.c | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 48cd411378..d73e86d889 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2243. [func] Configuration files without a newline at the end now + parse without error. [RT #17120] + 2242. [bug] nsupdate: GSS-TSIG support using the Heimdal Kerberos library could require a source of random data. [RT #17127] diff --git a/lib/isc/lex.c b/lib/isc/lex.c index 8d5b4219eb..8749ed0b0b 100644 --- a/lib/isc/lex.c +++ b/lib/isc/lex.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lex.c,v 1.85 2007/06/19 23:47:17 tbox Exp $ */ +/* $Id: lex.c,v 1.86 2007/09/17 09:56:29 shane Exp $ */ /*! \file */ @@ -720,11 +720,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { state = lexstate_ccomment; break; case lexstate_eatline: - if (c == EOF) { - result = ISC_R_UNEXPECTEDEND; - goto done; - } - if (c == '\n') { + if ((c == '\n') || (c == EOF)) { no_comments = ISC_FALSE; state = saved_state; goto no_read;