--- ksh-20120801/src/cmd/ksh93/sh/main.c 2015-04-17 16:55:57.802048900 -0300 +++ ksh-20120801/src/cmd/ksh93/sh/main.c 2015-04-17 17:10:45.276129709 -0300 @@ -423,7 +423,7 @@ static void exfile(register Shell_t *shp sfsync(shp->outpool); shp->st.execbrk = shp->st.breakcnt = 0; /* check for return from profile or env file */ - if(sh_isstate(SH_PROFILE) && (jmpval==SH_JMPFUN || jmpval==SH_JMPEXIT)) + if(sh_isstate(SH_PROFILE) && (jmpval==SH_JMPFUN || jmpval==SH_JMPEXIT || jmpval==SH_JMPERREXIT)) { sh_setstate(states); goto done; @@ -600,6 +600,8 @@ done: siglongjmp(*shp->jmplist,jmpval); else if(jmpval == SH_JMPEXIT) sh_done(shp,0); + else if(jmpval == SH_JMPERREXIT) + sh_done(shp,-1); if(fno>0) sh_close(fno); if(shp->st.filename)