From e822d8d8c46def2ef128f2aa6e064de8ef8eb18a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 19 Feb 2015 17:33:27 -0600 Subject: [PATCH] Suppress corrupt error output from dbStatic parser The yyerror() routine gets called twice in some cases. Don't print the yytext or input file location the second time through -- yytext has already been freed, and the user doesn't need to see the location twice. Fixes lp:1422803 --- src/dbStatic/dbYacc.y | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dbStatic/dbYacc.y b/src/dbStatic/dbYacc.y index b8cc9b4cf..24be58d87 100644 --- a/src/dbStatic/dbYacc.y +++ b/src/dbStatic/dbYacc.y @@ -266,12 +266,14 @@ alias: tokenALIAS '(' tokenSTRING ',' tokenSTRING ')' static int yyerror(char *str) { if (str) - epicsPrintf("Error: %s\n ", str); + epicsPrintf("Error: %s\n", str); else epicsPrintf("Error"); - epicsPrintf(" at or before \"%s\"", yytext); - dbIncludePrint(); - yyFailed = TRUE; + if (!yyFailed) { /* Only print this stuff once */ + epicsPrintf(" at or before \"%s\"", yytext); + dbIncludePrint(); + yyFailed = TRUE; + } return(0); } static long pvt_yy_parse(void)