diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-07-21 14:40:08 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-07-21 14:42:13 +0200 |
commit | 49117b48008e0fe36d6680c787045cb44a300f93 (patch) | |
tree | c1df4e74c3cccaaf719122562a2dc937c2f665a2 /shell/hush.c | |
parent | e695ac97fdd48808dd0a84d4725a063481a03c30 (diff) | |
download | busybox-w32-49117b48008e0fe36d6680c787045cb44a300f93.tar.gz busybox-w32-49117b48008e0fe36d6680c787045cb44a300f93.tar.bz2 busybox-w32-49117b48008e0fe36d6680c787045cb44a300f93.zip |
hush: fix a possible bug
Not sure this was actually a triggerable bug, but the code looked flaky.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index eabe83ac6..ab192e2cd 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -9153,9 +9153,11 @@ static int FAST_FUNC builtin_break(char **argv) | |||
9153 | unsigned depth; | 9153 | unsigned depth; |
9154 | if (G.depth_of_loop == 0) { | 9154 | if (G.depth_of_loop == 0) { |
9155 | bb_error_msg("%s: only meaningful in a loop", argv[0]); | 9155 | bb_error_msg("%s: only meaningful in a loop", argv[0]); |
9156 | /* if we came from builtin_continue(), need to undo "= 1" */ | ||
9157 | G.flag_break_continue = 0; | ||
9156 | return EXIT_SUCCESS; /* bash compat */ | 9158 | return EXIT_SUCCESS; /* bash compat */ |
9157 | } | 9159 | } |
9158 | G.flag_break_continue++; /* BC_BREAK = 1 */ | 9160 | G.flag_break_continue++; /* BC_BREAK = 1, or BC_CONTINUE = 2 */ |
9159 | 9161 | ||
9160 | G.depth_break_continue = depth = parse_numeric_argv1(argv, 1, 1); | 9162 | G.depth_break_continue = depth = parse_numeric_argv1(argv, 1, 1); |
9161 | if (depth == UINT_MAX) | 9163 | if (depth == UINT_MAX) |