aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/lsb/killall.c2
-rw-r--r--toys/posix/sh.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/toys/lsb/killall.c b/toys/lsb/killall.c
index 7883c53d..debc3dfc 100644
--- a/toys/lsb/killall.c
+++ b/toys/lsb/killall.c
@@ -48,7 +48,7 @@ void killall_main(void)
toys.exitval++;
if (!*toys.optargs) {
- toys.exithelp = 1;
+ toys.exithelp++;
error_exit("Process name missing!");
}
diff --git a/toys/posix/sh.c b/toys/posix/sh.c
index 30900b30..32d05ec2 100644
--- a/toys/posix/sh.c
+++ b/toys/posix/sh.c
@@ -293,12 +293,17 @@ static void run_pipeline(struct pipeline *line)
// Is this command a builtin that should run in this process?
if (tl && (tl->flags & TOYFLAG_NOFORK)) {
struct toy_context temp;
+ jmp_buf rebound;
// This fakes lots of what toybox_main() does.
memcpy(&temp, &toys, sizeof(struct toy_context));
memset(&toys, 0, sizeof(struct toy_context));
- toy_init(tl, cmd->argv);
- tl->toy_main();
+
+ if (!setjmp(rebound)) {
+ toys.rebound = rebound;
+ toy_init(tl, cmd->argv);
+ tl->toy_main();
+ }
cmd->pid = toys.exitval;
free(toys.optargs);
if (toys.old_umask) umask(toys.old_umask);