aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-04-27 07:10:11 -0500
committerRob Landley <rob@landley.net>2021-04-27 07:10:11 -0500
commitda735a2052f64cd53a8b79596946ee187cc58a81 (patch)
tree382699c1ee605840ac6b88164eadd5d4b4db8fc1 /toys
parentde04ee7f8dede68073518fc8ed3889051a527157 (diff)
downloadtoybox-da735a2052f64cd53a8b79596946ee187cc58a81.tar.gz
Make toysh function return properly and run next statement.
Diffstat (limited to 'toys')
-rw-r--r--toys/pending/sh.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/toys/pending/sh.c b/toys/pending/sh.c
index 70d7280c..d0e73dc8 100644
--- a/toys/pending/sh.c
+++ b/toys/pending/sh.c
@@ -2366,6 +2366,7 @@ static struct sh_process *run_command(void)
else if (funk != TT.funcslen) {
(TT.ff->func = TT.functions[funk])->refcount++;
TT.ff->pl = TT.ff->func->pipeline;
+ TT.ff->next->pl = TT.ff->next->pl->next;
TT.ff->arg = pp->arg;
} else {
struct toy_list *tl = toy_find(*pp->arg.v);
@@ -2450,7 +2451,7 @@ static struct sh_pipeline *add_pl(struct sh_pipeline **ppl, struct sh_arg **arg)
{
struct sh_pipeline *pl = xzalloc(sizeof(struct sh_pipeline));
- *arg = pl->arg;
+ if (arg) *arg = pl->arg;
pl->lineno = TT.LINENO;
dlist_add_nomalloc((void *)ppl, (void *)pl);
@@ -2557,6 +2558,7 @@ static int parse_line(char *line, struct sh_pipeline **ppl,
(*ppl)->prev->next = pl->next;
pl->next = *ppl;
(*ppl)->prev = pl;
+ dlist_terminate(funky->pipeline = add_pl(&funky->pipeline, 0));
// Immature function has matured (meaning cleanup is different)
pl->type = 'F';