From 6acada6f39d7305c20057119277aec17c1438d3d Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Sun, 2 Oct 2011 09:18:34 +0400 Subject: [PATCH] preproc: %ifenv should require environment variable name to exist Otherwise naked %ifenv/%endif passes without a notice. Signed-off-by: Cyrill Gorcunov --- preproc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/preproc.c b/preproc.c index 6360dcce..00850382 100644 --- a/preproc.c +++ b/preproc.c @@ -1929,8 +1929,8 @@ static bool if_condition(Token * tline, enum preproc_token ct) case PPC_IFENV: tline = expand_smacro(tline); j = false; /* have we matched yet? */ - while (tline) { - skip_white_(tline); + skip_white_(tline); + do { if (!tline || (tline->type != TOK_ID && tline->type != TOK_STRING && (tline->type != TOK_PREPROC_ID || @@ -1948,7 +1948,8 @@ static bool if_condition(Token * tline, enum preproc_token ct) if (getenv(p)) j = true; tline = tline->next; - } + skip_white_(tline); + } while (tline); break; case PPC_IFIDN: -- 2.11.4.GIT