From a31b3426096f1545757386ce5191342c9c565fe5 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 28 Nov 1998 00:37:51 +0000 Subject: [PATCH] never say "error on line -1" --- parse.yacc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parse.yacc b/parse.yacc index 12d0cb92a..7a7cfd8e5 100644 --- a/parse.yacc +++ b/parse.yacc @@ -147,10 +147,10 @@ void yyerror(s) { /* save the line the first error occured on */ if (errorlineno == -1) - errorlineno = sudolineno - 1; + errorlineno = sudolineno ? sudolineno - 1 : 0; #ifndef TRACELEXER (void) fprintf(stderr, ">>> sudoers file: %s, line %d <<<\n", s, - sudolineno - 1); + sudolineno ? sudolineno - 1 : 0); #else (void) fprintf(stderr, "<*> "); #endif -- 2.40.0