From 91610984e90d0062cb4ea50b37428559d5e4ede5 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 20 Jun 2016 16:16:15 +0300 Subject: Avoid closing stdin. The default grecs parser closes stdin before returning. This might cause grief for programs assuming that open(2) never returns 0. * src/grecs-lex.l (yywrap): Avoid closing stdin. The yyin variable has meaning only if grecs_preprocessor is set. Otherwise, it will be assigned the pointer to stdin by lex-generated code. --- src/grecs-lex.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grecs-lex.l b/src/grecs-lex.l index 98bf384..bf97730 100644 --- a/src/grecs-lex.l +++ b/src/grecs-lex.l @@ -192,7 +192,7 @@ pid_t grecs_preproc_pid; int yywrap() { - if (yyin) { + if (grecs_preprocessor) { grecs_preproc_extrn_shutdown(grecs_preproc_pid); fclose(yyin); } else -- cgit v1.2.1