diff options
Diffstat (limited to 'shell')
5 files changed, 11 insertions, 0 deletions
diff --git a/shell/hush.c b/shell/hush.c index 0b2bc01f5..d1f687f9d 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -4625,6 +4625,11 @@ static int fetch_heredocs(o_string *as_string, struct pipe *pi, int heredoc_cnt, | |||
4625 | 4625 | ||
4626 | redir->rd_type = REDIRECT_HEREDOC2; | 4626 | redir->rd_type = REDIRECT_HEREDOC2; |
4627 | /* redir->rd_dup is (ab)used to indicate <<- */ | 4627 | /* redir->rd_dup is (ab)used to indicate <<- */ |
4628 | if (!redir->rd_filename) { | ||
4629 | /* examples: "echo <<", "echo <<<", "echo <<>" */ | ||
4630 | syntax_error("missing here document terminator"); | ||
4631 | return -1; | ||
4632 | } | ||
4628 | p = fetch_till_str(as_string, input, | 4633 | p = fetch_till_str(as_string, input, |
4629 | redir->rd_filename, redir->rd_dup); | 4634 | redir->rd_filename, redir->rd_dup); |
4630 | if (!p) { | 4635 | if (!p) { |
diff --git a/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF1.right b/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF1.right new file mode 100644 index 000000000..7af73557a --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF1.right | |||
@@ -0,0 +1 @@ | |||
hush: syntax error: missing here document terminator | |||
diff --git a/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF1.tests b/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF1.tests new file mode 100755 index 000000000..33ccde26b --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF1.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | echo << | ||
2 | echo Done: | ||
diff --git a/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF2.right b/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF2.right new file mode 100644 index 000000000..7af73557a --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF2.right | |||
@@ -0,0 +1 @@ | |||
hush: syntax error: missing here document terminator | |||
diff --git a/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF2.tests b/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF2.tests new file mode 100755 index 000000000..fcda11045 --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc_syntax_err_no_EOF2.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | echo << > | ||
2 | echo Done: | ||