diff options
author | jilles <jilles@FreeBSD.org> | 2011-06-05 14:13:15 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-06-05 14:13:15 +0000 |
commit | fba76e8544240faef25943d9886fc3bc31161eb9 (patch) | |
tree | dec8a05e107755532c22074f8da51760f2c5ab63 /bin | |
parent | c8f0bef5361aefeba950c1f660d51e9a146e0094 (diff) | |
download | FreeBSD-src-fba76e8544240faef25943d9886fc3bc31161eb9.zip FreeBSD-src-fba76e8544240faef25943d9886fc3bc31161eb9.tar.gz |
sh: Fix $? in heredocs on simple commands.
PR: bin/41410
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/eval.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 404de33..585f91e 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: |