ParseGetLine: don't treat a zero byte as end of buffer if P_end says it isn't.

Consume up to next newline, and issue a parse warning.
If no newline found before P_end, carry on as before.
This commit is contained in:
Simon J. Gerraty 2013-08-10 21:31:35 +00:00
parent 1f039bded4
commit 84efbe96f1
2 changed files with 11 additions and 1 deletions

View File

@ -2582,6 +2582,16 @@ ParseGetLine(int flags, int *length)
if (cf->P_end == NULL)
/* End of string (aka for loop) data */
break;
/* see if there is more we can parse */
while (ptr++ < cf->P_end) {
if ((ch = *ptr) == '\n') {
if (ptr > line && ptr[-1] == '\\')
continue;
Parse_Error(PARSE_WARNING,
"Zero byte read from file, skipping rest of line.");
break;
}
}
if (cf->nextbuf != NULL) {
/*
* End of this buffer; return EOF and outer logic

View File

@ -17,7 +17,7 @@ CLEANFILES+= bootstrap
# $Id: Makefile,v 1.17 2013/07/30 19:13:53 sjg Exp $
# Base version on src date
MAKE_VERSION= 20130730
MAKE_VERSION= 20130810
PROG?= ${.CURDIR:T}