diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2011-06-05 14:13:15 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2011-06-05 14:13:15 +0000 |
commit | b3f892d9e060f365d2051e3a89d5ae0ea1bafcc6 (patch) | |
tree | dec8a05e107755532c22074f8da51760f2c5ab63 | |
parent | b17788c1a919b03246c8360087020fc71cc47b23 (diff) | |
download | src-b3f892d9e060f365d2051e3a89d5ae0ea1bafcc6.tar.gz src-b3f892d9e060f365d2051e3a89d5ae0ea1bafcc6.zip |
Notes
-rw-r--r-- | bin/sh/eval.c | 3 | ||||
-rw-r--r-- | tools/regression/bin/sh/expansion/heredoc2.0 | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 404de3312182..585f91ead32a 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -409,6 +409,7 @@ evalsubshell(union node *n, int flags) struct job *jp; int backgnd = (n->type == NBACKGND); + oexitstatus = exitstatus; expredir(n->nredir.redirect); if ((!backgnd && flags & EV_EXIT && !have_traps()) || forkshell(jp = makejob(n, 1), n, backgnd) == 0) { @@ -436,6 +437,7 @@ evalredir(union node *n, int flags) struct jmploc *savehandler; volatile int in_redirect = 1; + oexitstatus = exitstatus; expredir(n->nredir.redirect); savehandler = handler; if (setjmp(jmploc.loc)) { @@ -478,7 +480,6 @@ expredir(union node *n) for (redir = n ; redir ; redir = redir->nfile.next) { struct arglist fn; fn.lastp = &fn.list; - oexitstatus = exitstatus; switch (redir->type) { case NFROM: case NTO: diff --git a/tools/regression/bin/sh/expansion/heredoc2.0 b/tools/regression/bin/sh/expansion/heredoc2.0 new file mode 100644 index 000000000000..255143296d4a --- /dev/null +++ b/tools/regression/bin/sh/expansion/heredoc2.0 @@ -0,0 +1,15 @@ +# $FreeBSD$ + +f() { return $1; } + +[ `f 42; cat <<EOF +$? +EOF +` = 42 ] || echo simple command bad + +long=`printf %08192d 0` + +[ `f 42; cat <<EOF +$long.$? +EOF +` = $long.42 ] || echo long simple command bad |