1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

Fix regression in 'return' introduced by 98e0fc94

This fixes two regression test failures in tests/functions.sh.

src/cmd/ksh93/bltins/cflow.c: b_exit():
- The exit status should of course only be cropped to 8 bits if
  b_exit() will actually exit, not if it returns from a function.

(cherry picked from commit 2d1e7f87551159c942b16de2a98dc72697988d26)
This commit is contained in:
Martijn Dekker 2020-06-08 17:00:49 +02:00
parent b5e52703e9
commit 40d0bdc287

View file

@ -70,7 +70,8 @@ done:
/* return outside of function, dotscript and profile is exit */
if(shp->fn_depth==0 && shp->dot_depth==0 && !sh_isstate(SH_PROFILE))
pp->mode = SH_JMPEXIT;
sh_exit((shp->savexit = n) & SH_EXITMASK);
shp->savexit = n;
sh_exit((pp->mode == SH_JMPEXIT) ? (n & SH_EXITMASK) : n);
return(1);
}