From: Ian Jackson Date: Thu, 3 Mar 2011 17:11:31 +0000 (+0000) Subject: libxl: correctly initialise yylineno X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3860f61cd10fe878bbb792b7ebb9e2d186589d37;p=people%2Fliuw%2Flibxenctrl-split%2Fxen.git libxl: correctly initialise yylineno Sometimes xl would read an uninitialised variable when printing error messages, resulting in things like this: /etc/xen/thing.cfg:1030057088: config parsing error near `"ws08r2-x64-2': lexical error This is because yylineno is a variable inside the scanner created by yylex_init, but it is not initialised by yylex_init. (Debian bug #616099.) On the way I discovered a lot of complication to do with the calling convention between bison and flex in reentrant parsers/scanners which use locations (Debian bug #616100) but as the above change makes the current code in xen-unstable work I don't propose to do anything else about that now in our tree. Signed-off-by: Ian Jackson Tested-by: Ian Campbell Acked-by: Ian Campbell Committed-by: Ian Jackson --- diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c index 663fdf9a02..f947c219b4 100644 --- a/tools/libxl/libxlu_cfg.c +++ b/tools/libxl/libxlu_cfg.c @@ -43,6 +43,9 @@ static void ctx_dispose(CfgParseContext *ctx) { static void parse(CfgParseContext *ctx) { /* On return, ctx.err will be updated with the error status. */ int r; + + xlu__cfg_yyset_lineno(1, ctx->scanner); + r= xlu__cfg_yyparse(ctx); if (r) assert(ctx->err);