diff options
author | Ron Yorston <rmy@pobox.com> | 2020-02-27 09:50:18 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-04-30 16:42:58 +0200 |
commit | da7a6dbfa5d78e3d5cec5906b402908505d0fcf9 (patch) | |
tree | 447621855bebf9cadd2ce2c47c944060988a87ac | |
parent | d1b75e1842b3e4f61daae2fb8a64d784a553f15c (diff) | |
download | busybox-w32-da7a6dbfa5d78e3d5cec5906b402908505d0fcf9.tar.gz busybox-w32-da7a6dbfa5d78e3d5cec5906b402908505d0fcf9.tar.bz2 busybox-w32-da7a6dbfa5d78e3d5cec5906b402908505d0fcf9.zip |
ash: fix build failure when command built-in is disabled
Since commit 7eb8eecbb (ash: eval: Add assignment built-in support
again) building BusyBox with the 'command' built-in disabled fails.
parse_command_args() only needs to be called when the 'command'
built-in is run. Which it won't be if it's disabled.
v2: Avoiding infinite loops is good, too. Thanks, Harald van Dijk.
Reported-by: Deweloper <deweloper@wp.pl>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index d0d99f60e..a11b1d67d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -8675,7 +8675,6 @@ typecmd(int argc UNUSED_PARAM, char **argv) | |||
8675 | return err; | 8675 | return err; |
8676 | } | 8676 | } |
8677 | 8677 | ||
8678 | #if ENABLE_ASH_CMDCMD | ||
8679 | static struct strlist * | 8678 | static struct strlist * |
8680 | fill_arglist(struct arglist *arglist, union node **argpp) | 8679 | fill_arglist(struct arglist *arglist, union node **argpp) |
8681 | { | 8680 | { |
@@ -8692,6 +8691,7 @@ fill_arglist(struct arglist *arglist, union node **argpp) | |||
8692 | return *lastp; | 8691 | return *lastp; |
8693 | } | 8692 | } |
8694 | 8693 | ||
8694 | #if ENABLE_ASH_CMDCMD | ||
8695 | /* Is it "command [-p] PROG ARGS" bltin, no other opts? Return ptr to "PROG" if yes */ | 8695 | /* Is it "command [-p] PROG ARGS" bltin, no other opts? Return ptr to "PROG" if yes */ |
8696 | static int | 8696 | static int |
8697 | parse_command_args(struct arglist *arglist, union node **argpp, const char **path) | 8697 | parse_command_args(struct arglist *arglist, union node **argpp, const char **path) |
@@ -10190,11 +10190,13 @@ evalcommand(union node *cmd, int flags) | |||
10190 | vlocal = !spclbltin; | 10190 | vlocal = !spclbltin; |
10191 | } | 10191 | } |
10192 | cmd_is_exec = cmdentry.u.cmd == EXECCMD; | 10192 | cmd_is_exec = cmdentry.u.cmd == EXECCMD; |
10193 | #if ENABLE_ASH_CMDCMD | ||
10193 | if (cmdentry.u.cmd != COMMANDCMD) | 10194 | if (cmdentry.u.cmd != COMMANDCMD) |
10194 | break; | 10195 | break; |
10195 | 10196 | ||
10196 | cmd_flag = parse_command_args(&arglist, &argp, &path); | 10197 | cmd_flag = parse_command_args(&arglist, &argp, &path); |
10197 | if (!cmd_flag) | 10198 | if (!cmd_flag) |
10199 | #endif | ||
10198 | break; | 10200 | break; |
10199 | } | 10201 | } |
10200 | 10202 | ||