yyrecursive needs its own and empty heres[]

fixes http://thread.gmane.org/gmane.comp.shells.dash/1241/focus=1245
This commit is contained in:
tg 2016-02-26 21:24:58 +00:00
parent 3b5f9c744c
commit 4a21365067
1 changed files with 5 additions and 1 deletions

6
syn.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.110 2016/01/21 18:24:44 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.111 2016/02/26 21:24:58 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@ -31,6 +31,7 @@ struct nesting_state {
};
struct yyrecursive_state {
struct ioword *old_heres[HERES];
struct yyrecursive_state *next;
struct ioword **old_herep;
int old_symbol;
@ -1175,7 +1176,9 @@ yyrecursive(int subtype MKSH_A_UNUSED)
ys->old_reject = reject;
ys->old_symbol = symbol;
ACCEPT;
memcpy(ys->old_heres, heres, sizeof(heres));
ys->old_herep = herep;
herep = heres;
ys->old_salias = sALIAS;
sALIAS = 0;
ys->next = e->yyrecursive_statep;
@ -1202,6 +1205,7 @@ yyrecursive_pop(bool popall)
e->yyrecursive_statep = ys->next;
sALIAS = ys->old_salias;
memcpy(heres, ys->old_heres, sizeof(heres));
herep = ys->old_herep;
reject = ys->old_reject;
symbol = ys->old_symbol;