From cbd9d6f32dfcfe5e306d60cc1f12c1f4ef30db5a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 20 Nov 1998 19:22:45 +0000 Subject: [PATCH] when we get a syntax error, report it for the previous line since that's generally where the error occurred. --- parse.yacc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parse.yacc b/parse.yacc index 4d11f6dc1..3c939ec94 100644 --- a/parse.yacc +++ b/parse.yacc @@ -147,9 +147,10 @@ void yyerror(s) { /* save the line the first error occured on */ if (errorlineno == -1) - errorlineno = sudolineno; + errorlineno = sudolineno - 1; #ifndef TRACELEXER - (void) fprintf(stderr, ">>> sudoers file: %s, line %d <<<\n", s, sudolineno); + (void) fprintf(stderr, ">>> sudoers file: %s, line %d <<<\n", s, + sudolineno - 1); #else (void) fprintf(stderr, "<*> "); #endif -- 2.40.0