1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

Reset sh.arithrecursion in sh_exit() instead (re: d50d3d7c)

Since the arithmetic recursion level only becomes incorrect when
an error interrupts the arithmetic subsystem, and all such error
messages call sh_exit(), it should be good enough to reset it
there, so we don't need to do that for nearly every sh_exec() run.
This commit is contained in:
Martijn Dekker 2021-11-25 10:13:06 +01:00
parent 27ccdd2517
commit f3433a696a
2 changed files with 1 additions and 4 deletions

View file

@ -580,6 +580,7 @@ void sh_exit(register int xno)
sfclrlock(sfstdin);
if(!pp)
sh_done(shp,sig);
shp->arithrecursion = 0;
shp->prefix = 0;
#if SHOPT_TYPEDEF
shp->mktype = 0;

View file

@ -978,7 +978,6 @@ int sh_exec(register const Shnode_t *t, int flags)
error_info.line = t->com.comline-shp->st.firstline;
com = sh_argbuild(shp,&argn,&(t->com),OPTIMIZE);
echeck = 1;
shp->arithrecursion = 0;
if(t->tre.tretyp&COMSCAN)
{
argp = t->com.comarg;
@ -1890,7 +1889,6 @@ int sh_exec(register const Shnode_t *t, int flags)
case TPAR:
echeck = 1;
shp->arithrecursion = 0;
flags &= ~OPTIMIZE_FLAG;
if(!shp->subshell && !shp->st.trapcom[0] && !shp->st.trap[SH_ERRTRAP] && (flags&sh_state(SH_NOFORK)))
{
@ -1960,7 +1958,6 @@ int sh_exec(register const Shnode_t *t, int flags)
int *exitval=0,*saveexitval = job.exitval;
pid_t savepgid = job.curpgid;
echeck = 1;
shp->arithrecursion = 0;
job.exitval = 0;
job.curjobid = 0;
if(shp->subshell)
@ -2643,7 +2640,6 @@ int sh_exec(register const Shnode_t *t, int flags)
skipexitset++;
error_info.line = t->tst.tstline-shp->st.firstline;
echeck = 1;
shp->arithrecursion = 0;
if((type&TPAREN)==TPAREN)
{
sh_exec(t->lst.lstlef,OPTIMIZE);