summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2016-06-20 13:16:15 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2016-06-20 13:20:20 (GMT)
commit91610984e90d0062cb4ea50b37428559d5e4ede5 (patch) (side-by-side diff)
tree99deb3719161a870e98eea008f4aaf8619855e58
parent6ab660a7f9a9857a56cff44765144016356bd9f1 (diff)
downloadgrecs-91610984e90d0062cb4ea50b37428559d5e4ede5.tar.gz
grecs-91610984e90d0062cb4ea50b37428559d5e4ede5.tar.bz2
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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/grecs-lex.l2
1 files changed, 1 insertions, 1 deletions
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

Return to:

Send suggestions and report system problems to the System administrator.