summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenis Vlasenko2009-04-19 14:03:11 +0000
committerDenis Vlasenko2009-04-19 14:03:11 +0000
commit9f8d9381727fa517bbe3adf4f18e856a936057a7 (patch)
tree4e54e0cb62ffbdcd5ffe466ffd68e1f20b4f1ccd /shell
parentbf25fbccb9b2641c77685ac0a537e8068b6b354a (diff)
downloadbusybox-9f8d9381727fa517bbe3adf4f18e856a936057a7.zip
busybox-9f8d9381727fa517bbe3adf4f18e856a936057a7.tar.gz
same as previous, but -100 bytes
Diffstat (limited to 'shell')
-rw-r--r--shell/hush.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 62b1d48..c542b7d 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -5476,22 +5476,24 @@ static struct pipe *parse_stream(char **pstring,
* will still trigger for us */
}
}
+
+ /* "cmd}" or "cmd }..." without semicolon or &:
+ * } is an ordinary char in this case, even inside { cmd; }
+ * Pathological example: { ""}; } should exec "}" cmd
+ */
+ if (ch == '}'
+ && !(IS_NULL_PIPE(ctx.pipe)
+ && IS_NULL_CMD(ctx.command)
+ && dest.length == 0
+ && !dest.o_quoted
+ )
+ ) {
+ goto ordinary_char;
+ }
+
if (end_trigger && end_trigger == ch
&& (heredoc_cnt == 0 || end_trigger != ';')
) {
- /* "{ cmd}" or "{ cmd }..." without semicolon or &:
- * } is an ordinary char in this case.
- * Pathological example: { ""}; } should exec "}" cmd
- */
- if (ch == '}'
- && !(IS_NULL_PIPE(ctx.pipe)
- && IS_NULL_CMD(ctx.command)
- && dest.length == 0
- && !dest.o_quoted
- )
- ) {
- goto ordinary_char;
- }
if (heredoc_cnt) {
/* This is technically valid:
* { cat <<HERE; }; echo Ok
@@ -5757,16 +5759,6 @@ static struct pipe *parse_stream(char **pstring,
goto case_semi;
#endif
case '}':
- if (!(IS_NULL_PIPE(ctx.pipe)
- && IS_NULL_CMD(ctx.command)
- && dest.length == 0
- && !dest.o_quoted
- )
- ) {
- /* } not preceded by ; or & is an ordinary
- * char, example: "echo }" */
- goto ordinary_char;
- }
/* proper use of this character is caught by end_trigger:
* if we see {, we call parse_group(..., end_trigger='}')
* and it will match } earlier (not here). */