summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-02-05 15:02:19 +0000
committerjilles <jilles@FreeBSD.org>2011-02-05 15:02:19 +0000
commitff6aee65ced361bd15132be42d4fc4424670f651 (patch)
treef09d358ca460ca4e423df11e30360f9a4012e6c0 /bin/sh
parent9a75a8c404567dc1fee863ef113ddf6ead6fd02f (diff)
downloadFreeBSD-src-ff6aee65ced361bd15132be42d4fc4424670f651.zip
FreeBSD-src-ff6aee65ced361bd15132be42d4fc4424670f651.tar.gz
sh: Fix two things about {(...)} <redir:
* In {(...) <redir1;} <redir2, do not drop redir1. * Maintain the difference between (...) <redir and {(...)} <redir: In (...) <redir, the redirection is performed in the child, while in {(...)} <redir it should be performed in the parent (like {(...); :;} <redir)
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/parser.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 4a2ffa4..f883dff 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -389,8 +389,10 @@ command(void)
union node *cp, **cpp;
union node *redir, **rpp;
int t;
+ int is_subshell;
checkkwd = CHKNL | CHKKWD | CHKALIAS;
+ is_subshell = 0;
redir = NULL;
n1 = NULL;
rpp = &redir;
@@ -558,6 +560,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
if (readtoken() != TRP)
synexpect(TRP);
checkkwd = CHKKWD | CHKALIAS;
+ is_subshell = 1;
break;
case TBEGIN:
n1 = list(0, 0);
@@ -596,7 +599,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
tokpushback++;
*rpp = NULL;
if (redir) {
- if (n1->type != NSUBSHELL) {
+ if (!is_subshell) {
n2 = (union node *)stalloc(sizeof (struct nredir));
n2->type = NREDIR;
n2->nredir.n = n1;
OpenPOWER on IntegriCloud