search for: exexit

Displaying 19 results from an estimated 19 matches for "exexit".

2020 Mar 28
0
[klibc:update-dash] dash: eval: Only restore exit status on exit/return
...ions(+), 8 deletions(-) diff --git a/usr/dash/error.h b/usr/dash/error.h index f91d11d1..8df0134f 100644 --- a/usr/dash/error.h +++ b/usr/dash/error.h @@ -69,7 +69,8 @@ extern int exception; /* exceptions */ #define EXINT 0 /* SIGINT received */ #define EXERROR 1 /* a generic error */ -#define EXEXIT 4 /* exit the shell */ +#define EXEND 3 /* exit the shell */ +#define EXEXIT 4 /* exit the shell via exitcmd */ /* diff --git a/usr/dash/eval.c b/usr/dash/eval.c index bba0e7f8..1aad31a0 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -114,12 +114,13 @@ STATIC const struct builtincmd bl...
2020 Mar 28
0
[klibc:update-dash] dash: eval: make traps work when "set -e" is enabled
.../dash/eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 01bc5234..09a5cbf1 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -307,11 +307,11 @@ setstatus: break; } out: + dotrap(); + if (checkexit & status) goto exexit; - dotrap(); - if (flags & EV_EXIT) { exexit: exraise(EXEXIT);
2019 Jan 25
0
[klibc:update-dash] [TRAP] Make sure evalskip is zero before running traps
.../eval.c @@ -197,6 +197,9 @@ evaltree(union node *n, int flags) TRACE(("evaltree(NULL) called\n")); goto out; } + + dotrap(); + #ifndef SMALL displayhist = 1; /* show history substitutions done with fc */ #endif @@ -308,8 +311,7 @@ out: if (checkexit & exitstatus) goto exexit; - if (pendingsigs) - dotrap(); + dotrap(); if (flags & EV_EXIT) { exexit: diff --git a/usr/dash/trap.c b/usr/dash/trap.c index 182fa7ac..3ff45318 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -315,6 +315,9 @@ void dotrap(void) int i; int savestatus; + if (!pendingsigs) +...
2020 Mar 28
0
[klibc:update-dash] dash: [TRAP] Make sure evalskip is zero before running traps
.../eval.c @@ -197,6 +197,9 @@ evaltree(union node *n, int flags) TRACE(("evaltree(NULL) called\n")); goto out; } + + dotrap(); + #ifndef SMALL displayhist = 1; /* show history substitutions done with fc */ #endif @@ -308,8 +311,7 @@ out: if (checkexit & exitstatus) goto exexit; - if (pendingsigs) - dotrap(); + dotrap(); if (flags & EV_EXIT) { exexit: diff --git a/usr/dash/trap.c b/usr/dash/trap.c index 182fa7ac..3ff45318 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -315,6 +315,9 @@ void dotrap(void) int i; int savestatus; + if (!pendingsigs) +...
2020 Mar 28
0
[klibc:update-dash] dash: eval: avoid leaking memory associated with redirections
...+200,12 @@ evaltree(union node *n, int flags) { int checkexit = 0; int (*evalfn)(union node *, int); + struct stackmark smark; unsigned isor; int status = 0; + + setstackmark(&smark); + if (n == NULL) { TRACE(("evaltree(NULL) called\n")); goto out; @@ -317,6 +321,8 @@ exexit: exraise(EXEXIT); } + popstackmark(&smark); + return exitstatus; } @@ -396,14 +402,12 @@ evalfor(union node *n, int flags) struct arglist arglist; union node *argp; struct strlist *sp; - struct stackmark smark; int status; errlinno = lineno = n->nfor.linno; if (func...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Exit without arguments in a trap should use status outside traps
...h/main.c @@ -339,8 +339,15 @@ exitcmd(int argc, char **argv) { if (stoppedjobs()) return 0; - if (argc > 1) - exitstatus = number(argv[1]); + + if (argc > 1) { + int status = number(argv[1]); + + exitstatus = status; + if (savestatus >= 0) + savestatus = status; + } + exraise(EXEXIT); /* NOTREACHED */ } diff --git a/usr/dash/trap.c b/usr/dash/trap.c index 3ff45318..7dd8342f 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -313,12 +313,17 @@ void dotrap(void) char *p; char *q; int i; - int savestatus; + int status, last_status; if (!pendingsigs) return; -...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Exit without arguments in a trap should use status outside traps
...h/main.c @@ -339,8 +339,15 @@ exitcmd(int argc, char **argv) { if (stoppedjobs()) return 0; - if (argc > 1) - exitstatus = number(argv[1]); + + if (argc > 1) { + int status = number(argv[1]); + + exitstatus = status; + if (savestatus >= 0) + savestatus = status; + } + exraise(EXEXIT); /* NOTREACHED */ } diff --git a/usr/dash/trap.c b/usr/dash/trap.c index 3ff45318..7dd8342f 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -313,12 +313,17 @@ void dotrap(void) char *p; char *q; int i; - int savestatus; + int status, last_status; if (!pendingsigs) return; -...
2019 Jan 25
0
[klibc:update-dash] eval: Return status in eval functions
...gt;nif.elsepart) { n = n->nif.elsepart; goto evaln; } - goto success; + status = 0; + goto setstatus; case NDEFUN: defun(n); -success: - status = 0; setstatus: exitstatus = status; break; } out: - if (checkexit & exitstatus) + if (checkexit & status) goto exexit; dotrap(); @@ -323,6 +315,8 @@ out: exexit: exraise(EXEXIT); } + + return exitstatus; } @@ -363,7 +357,7 @@ static int skiploop(void) } -STATIC void +STATIC int evalloop(union node *n, int flags) { int skip; @@ -375,33 +369,34 @@ evalloop(union node *n, int flags) do {...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Return status in eval functions
...gt;nif.elsepart) { n = n->nif.elsepart; goto evaln; } - goto success; + status = 0; + goto setstatus; case NDEFUN: defun(n); -success: - status = 0; setstatus: exitstatus = status; break; } out: - if (checkexit & exitstatus) + if (checkexit & status) goto exexit; dotrap(); @@ -323,6 +315,8 @@ out: exexit: exraise(EXEXIT); } + + return exitstatus; } @@ -363,7 +357,7 @@ static int skiploop(void) } -STATIC void +STATIC int evalloop(union node *n, int flags) { int skip; @@ -375,33 +369,34 @@ evalloop(union node *n, int flags) do {...
2019 Jan 25
0
[klibc:update-dash] [ERROR] Set exitstatus in onint
.../usr/dash/eval.c b/usr/dash/eval.c index 741bf120..501d47fe 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -853,21 +853,15 @@ bail: listsetvar(varlist.list, VEXPORT); } if (evalbltin(cmdentry.u.cmd, argc, argv, flags)) { - int status; - int i; - - i = exception; - if (i == EXEXIT) - goto raise; - - status = (i == EXINT) ? SIGINT + 128 : 2; - exitstatus = status; - - if (i == EXINT || spclbltin > 0) { -raise: - longjmp(handler->loc, 1); + if (exception == EXERROR) { + exitstatus = 2; + if (spclbltin <= 0) { + FORCEINTON; + break; + }...
2020 Mar 28
0
[klibc:update-dash] dash: [ERROR] Set exitstatus in onint
.../usr/dash/eval.c b/usr/dash/eval.c index 578d8919..b3e971bf 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -853,21 +853,15 @@ bail: listsetvar(varlist.list, VEXPORT); } if (evalbltin(cmdentry.u.cmd, argc, argv, flags)) { - int status; - int i; - - i = exception; - if (i == EXEXIT) - goto raise; - - status = (i == EXINT) ? SIGINT + 128 : 2; - exitstatus = status; - - if (i == EXINT || spclbltin > 0) { -raise: - longjmp(handler->loc, 1); + if (exception == EXERROR) { + exitstatus = 2; + if (spclbltin <= 0) { + FORCEINTON; + break; + }...
2020 Mar 28
0
[klibc:update-dash] dash: main: Only set savestatus in exitcmd
...dash/main.c @@ -339,13 +339,8 @@ exitcmd(int argc, char **argv) if (stoppedjobs()) return 0; - if (argc > 1) { - int status = number(argv[1]); - - exitstatus = status; - if (savestatus >= 0) - savestatus = status; - } + if (argc > 1) + savestatus = number(argv[1]); exraise(EXEXIT); /* NOTREACHED */
2020 Mar 28
0
[klibc:update-dash] dash: eval: Reset handler when entering a subshell
...{ int e; int s; @@ -137,7 +137,7 @@ main(int argc, char **argv) else goto state4; } - handler = &jmploc; + handler = &main_handler; #ifdef DEBUG opentrace(); trputs("Shell args: "); trargs(argv); @@ -353,3 +353,8 @@ exitcmd(int argc, char **argv) exraise(EXEXIT); /* NOTREACHED */ } + +void reset_handler(void) +{ + handler = &main_handler; +} diff --git a/usr/dash/main.h b/usr/dash/main.h index 19e49835..51f1604c 100644 --- a/usr/dash/main.h +++ b/usr/dash/main.h @@ -52,3 +52,4 @@ extern int *dash_errno; void readcmdfile(char *); int dotcmd(int, c...
2011 Jun 14
0
klibc 1.5.23 release
...Fix corruption of redirections with byte 0x81 [klibc] [VAR] Fix varinit ordering that broke fc [klibc] [REDIR] Replace GPL noclobberopen code with the FreeBSD version [klibc] [EXPAND] Do not split the result of tilde expansion Jonathan Nieder (5): [klibc] [BUILTIN] Use EXEXIT in place of EXEXEC [klibc] [BUILTIN] Stop documenting EXSHELLPROC [klibc] [BUILTIN] Dotcmd should exit with zero when doing nothing [klibc] [EXPAND] Free IFS state after here document expansion [klibc] [DEBUG] Use va_copy when reusing a va_list Konstantinos Margaritis (1):...
2020 Mar 28
0
[klibc:update-dash] dash: mkinit: Split reset into exitreset and reset
...f --git a/usr/dash/main.c b/usr/dash/main.c index 9f037173..8b351189 100644 --- a/usr/dash/main.c +++ b/usr/dash/main.c @@ -106,7 +106,7 @@ main(int argc, char **argv) int e; int s; - reset(); + exitreset(); e = exception; @@ -114,6 +114,8 @@ main(int argc, char **argv) if (e == EXEXIT || s == 0 || iflag == 0 || shlvl) exitshell(); + reset(); + if (e == EXINT #if ATTY && (! attyset() || equal(termval(), "emacs")) diff --git a/usr/dash/mkinit.c b/usr/dash/mkinit.c index 9714bee0..5bca9ee8 100644 --- a/usr/dash/mkinit.c +++ b/usr/dash/mkinit.c @@ -1...
2010 Mar 22
1
[git pull] dash, sh4, README's
...lines after var name in for statements [klibc] [PARSER] Use CHKNL to parse case statements [klibc] [REDIR] Fix incorrect savefd conversions [klibc] [EXPAND] Fix quoted pattern patch breakage [klibc] [EVAL] Pass EV_TESTED into evalcmd [klibc] [EVAL] Revert SKIPEVAL into EXEXIT [klibc] [BUILTIN] Fix NUL termination in readcmd [klibc] [CD] Lookup PWD after going through CDPATH [klibc] [BUILTIN] Fix off-by-one recordregion in readcmd [klibc] [ARITH] Fix binary operator parsing [klibc] [REDIR] Do not truncate file for FROMTO redirection Jilles...
2010 Apr 16
0
[git pull v4] dash, sh4, ipconfig, dprintf, fstype, README's
...lines after var name in for statements [klibc] [PARSER] Use CHKNL to parse case statements [klibc] [REDIR] Fix incorrect savefd conversions [klibc] [EXPAND] Fix quoted pattern patch breakage [klibc] [EVAL] Pass EV_TESTED into evalcmd [klibc] [EVAL] Revert SKIPEVAL into EXEXIT [klibc] [BUILTIN] Fix NUL termination in readcmd [klibc] [CD] Lookup PWD after going through CDPATH [klibc] [BUILTIN] Fix off-by-one recordregion in readcmd [klibc] [ARITH] Fix binary operator parsing [klibc] [REDIR] Do not truncate file for FROMTO redirection [k...
2010 Apr 16
0
[PATCH] pull faccessat() system call
...lines after var name in for statements [klibc] [PARSER] Use CHKNL to parse case statements [klibc] [REDIR] Fix incorrect savefd conversions [klibc] [EXPAND] Fix quoted pattern patch breakage [klibc] [EVAL] Pass EV_TESTED into evalcmd [klibc] [EVAL] Revert SKIPEVAL into EXEXIT [klibc] [BUILTIN] Fix NUL termination in readcmd [klibc] [CD] Lookup PWD after going through CDPATH [klibc] [BUILTIN] Fix off-by-one recordregion in readcmd [klibc] [ARITH] Fix binary operator parsing [klibc] [REDIR] Do not truncate file for FROMTO redirection [k...
2010 Mar 28
1
[git pull v3] dash, sh4, ipconfig, dprintf, fstype, README's
...lines after var name in for statements [klibc] [PARSER] Use CHKNL to parse case statements [klibc] [REDIR] Fix incorrect savefd conversions [klibc] [EXPAND] Fix quoted pattern patch breakage [klibc] [EVAL] Pass EV_TESTED into evalcmd [klibc] [EVAL] Revert SKIPEVAL into EXEXIT [klibc] [BUILTIN] Fix NUL termination in readcmd [klibc] [CD] Lookup PWD after going through CDPATH [klibc] [BUILTIN] Fix off-by-one recordregion in readcmd [klibc] [ARITH] Fix binary operator parsing [klibc] [REDIR] Do not truncate file for FROMTO redirection Jilles...