=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/doas/parse.y,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- src/usr.bin/doas/parse.y 2015/11/27 21:10:17 1.13 +++ src/usr.bin/doas/parse.y 2015/12/04 09:41:49 1.14 @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.13 2015/11/27 21:10:17 tedu Exp $ */ +/* $OpenBSD: parse.y,v 1.14 2015/12/04 09:41:49 tedu Exp $ */ /* * Copyright (c) 2015 Ted Unangst * @@ -223,12 +223,12 @@ /* skip comments; NUL is allowed; no continuation */ while ((c = getc(yyfp)) != '\n') if (c == EOF) - return 0; + goto eof; yylval.colno = 0; yylval.lineno++; return c; case EOF: - return 0; + goto eof; } /* parsing next word */ @@ -302,7 +302,7 @@ * the main loop. */ if (c == EOF) - return 0; + goto eof; else if (qpos == -1) /* accept, e.g., empty args: cmd foo args "" */ goto repeat; } @@ -316,4 +316,9 @@ err(1, "strdup"); yylval.str = str; return TSTRING; + +eof: + if (ferror(yyfp)) + yyerror("input error reading config"); + return 0; }