ash: [EVAL] Revert SKIPEVAL into EXEXIT

Upstream commit:

    Date:   Tue Aug 11 20:56:53 2009 +1000
    [EVAL] Revert SKIPEVAL into EXEXIT

    Now that eval handles EV_TESTED correctly, we can remove the
    SKIPEVAL hack and simply use EXEXIT for set -e.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2016-10-01 15:27:44 +02:00
parent 7b3fa1e441
commit 0840c91909

View File

@ -8407,7 +8407,6 @@ defun(char *name, union node *func)
#define SKIPBREAK (1 << 0) #define SKIPBREAK (1 << 0)
#define SKIPCONT (1 << 1) #define SKIPCONT (1 << 1)
#define SKIPFUNC (1 << 2) #define SKIPFUNC (1 << 2)
#define SKIPEVAL (1 << 4)
static smallint evalskip; /* set to SKIPxxx if we are skipping commands */ static smallint evalskip; /* set to SKIPxxx if we are skipping commands */
static int skipcount; /* number of levels to skip */ static int skipcount; /* number of levels to skip */
static int funcnest; /* depth of function calls */ static int funcnest; /* depth of function calls */
@ -8612,13 +8611,10 @@ evaltree(union node *n, int flags)
/* Order of checks below is important: /* Order of checks below is important:
* signal handlers trigger before exit caused by "set -e". * signal handlers trigger before exit caused by "set -e".
*/ */
if (pending_sig && dotrap()) if ((pending_sig && dotrap())
goto exexit; || (checkexit & status)
if (checkexit & status) || (flags & EV_EXIT)
evalskip |= SKIPEVAL; ) {
if (flags & EV_EXIT) {
exexit:
raise_exception(EXEXIT); raise_exception(EXEXIT);
} }
@ -12360,7 +12356,7 @@ cmdloop(int top)
if (skip) { if (skip) {
evalskip &= ~SKIPFUNC; evalskip &= ~SKIPFUNC;
return skip & SKIPEVAL; break;
} }
} }
return status; return status;
@ -13263,14 +13259,10 @@ procargs(char **argv)
static void static void
read_profile(const char *name) read_profile(const char *name)
{ {
int skip;
if (setinputfile(name, INPUT_PUSH_FILE | INPUT_NOFILE_OK) < 0) if (setinputfile(name, INPUT_PUSH_FILE | INPUT_NOFILE_OK) < 0)
return; return;
skip = cmdloop(0); cmdloop(0);
popfile(); popfile();
if (skip)
exitshell();
} }
/* /*