fix the set +e cases, too

This commit is contained in:
tg
2013-01-01 22:23:16 +00:00
parent 72a748c891
commit d5ba31fd86
2 changed files with 77 additions and 31 deletions

30
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.250 2013/01/01 20:45:03 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.251 2013/01/01 22:23:16 tg Exp $");
extern char **environ;
@ -872,20 +872,6 @@ shell(Source * volatile s, volatile bool toplevel)
void
unwind(int i)
{
/* ordering for EXIT vs ERR is a bit odd (this is what AT&T ksh does) */
if (i == LEXIT || (Flag(FERREXIT) == 1 &&
(i == LERROR || i == LINTR) && sigtraps[ksh_SIGEXIT].trap)) {
++trap_nested;
runtrap(&sigtraps[ksh_SIGEXIT], trap_nested == 1);
--trap_nested;
i = LLEAVE;
} else if (Flag(FERREXIT) == 1 && (i == LERROR || i == LINTR)) {
++trap_nested;
runtrap(&sigtraps[ksh_SIGERR], trap_nested == 1);
--trap_nested;
i = LLEAVE;
}
/*
* This is a kludge. We need to restore everything that was
* changed in the new environment, see cid 1005090337C7A669439
@ -902,6 +888,20 @@ unwind(int i)
Flag(FERREXIT) &= ~0x80;
}
/* ordering for EXIT vs ERR is a bit odd (this is what AT&T ksh does) */
if (i == LEXIT ||
((i == LERROR || i == LINTR) && sigtraps[ksh_SIGEXIT].trap)) {
++trap_nested;
runtrap(&sigtraps[ksh_SIGEXIT], trap_nested == 1);
--trap_nested;
i = LLEAVE;
} else if (Flag(FERREXIT) == 1 && (i == LERROR || i == LINTR)) {
++trap_nested;
runtrap(&sigtraps[ksh_SIGERR], trap_nested == 1);
--trap_nested;
i = LLEAVE;
}
while (/* CONSTCOND */ 1) {
switch (e->type) {
case E_PARSE: