Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-06-15 19:12:13 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2021-11-23 07:31:30 +0300
commitbb612052900542046ce75e61a4e0b030c946984b (patch)
tree73d86eb70f874fea5842270aaf88e18404dc60d4
parent56a335378ac100d51c30b21eee499a2effa37fba (diff)
hush: fix handling of "cmd && &"
function old new delta done_pipe 213 231 +18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> (cherry picked from commit 83a4967e50422867f340328d404994553e56b839)
-rw-r--r--shell/hush.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 249728b9d..41a4653ea 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -3694,9 +3694,10 @@ static void debug_print_tree(struct pipe *pi, int lvl)
pin = 0;
while (pi) {
- fdprintf(2, "%*spipe %d %sres_word=%s followup=%d %s\n",
+ fdprintf(2, "%*spipe %d #cmds:%d %sres_word=%s followup=%d %s\n",
lvl*2, "",
pin,
+ pi->num_cmds,
(IF_HAS_KEYWORDS(pi->pi_inverted ? "! " :) ""),
RES[pi->res_word],
pi->followup, PIPE[pi->followup]
@@ -3839,6 +3840,9 @@ static void done_pipe(struct parse_context *ctx, pipe_style type)
#endif
/* Replace all pipes in ctx with one newly created */
ctx->list_head = ctx->pipe = pi;
+ /* for cases like "cmd && &", do not be tricked by last command
+ * being null - the entire {...} & is NOT null! */
+ not_null = 1;
} else {
no_conv:
ctx->pipe->followup = type;