diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-06-15 18:12:13 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-06-15 18:14:27 +0200 |
commit | 83a4967e50422867f340328d404994553e56b839 (patch) | |
tree | 86252a41acc9884f7728e89fd09db2cd2965ca2a | |
parent | 1b7a9b68d0e9aa19147d7fda16eb9a6b54156985 (diff) | |
download | busybox-w32-83a4967e50422867f340328d404994553e56b839.tar.gz busybox-w32-83a4967e50422867f340328d404994553e56b839.tar.bz2 busybox-w32-83a4967e50422867f340328d404994553e56b839.zip |
hush: fix handling of "cmd && &"
function old new delta
done_pipe 213 231 +18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/hush.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index e271c04d6..e8d24d40b 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -3696,9 +3696,10 @@ static void debug_print_tree(struct pipe *pi, int lvl) | |||
3696 | 3696 | ||
3697 | pin = 0; | 3697 | pin = 0; |
3698 | while (pi) { | 3698 | while (pi) { |
3699 | fdprintf(2, "%*spipe %d %sres_word=%s followup=%d %s\n", | 3699 | fdprintf(2, "%*spipe %d #cmds:%d %sres_word=%s followup=%d %s\n", |
3700 | lvl*2, "", | 3700 | lvl*2, "", |
3701 | pin, | 3701 | pin, |
3702 | pi->num_cmds, | ||
3702 | (IF_HAS_KEYWORDS(pi->pi_inverted ? "! " :) ""), | 3703 | (IF_HAS_KEYWORDS(pi->pi_inverted ? "! " :) ""), |
3703 | RES[pi->res_word], | 3704 | RES[pi->res_word], |
3704 | pi->followup, PIPE[pi->followup] | 3705 | pi->followup, PIPE[pi->followup] |
@@ -3841,6 +3842,9 @@ static void done_pipe(struct parse_context *ctx, pipe_style type) | |||
3841 | #endif | 3842 | #endif |
3842 | /* Replace all pipes in ctx with one newly created */ | 3843 | /* Replace all pipes in ctx with one newly created */ |
3843 | ctx->list_head = ctx->pipe = pi; | 3844 | ctx->list_head = ctx->pipe = pi; |
3845 | /* for cases like "cmd && &", do not be tricked by last command | ||
3846 | * being null - the entire {...} & is NOT null! */ | ||
3847 | not_null = 1; | ||
3844 | } else { | 3848 | } else { |
3845 | no_conv: | 3849 | no_conv: |
3846 | ctx->pipe->followup = type; | 3850 | ctx->pipe->followup = type; |