diff options
| author | Stefan Farfeleder <stefanf@FreeBSD.org> | 2005-09-10 07:41:36 +0000 |
|---|---|---|
| committer | Stefan Farfeleder <stefanf@FreeBSD.org> | 2005-09-10 07:41:36 +0000 |
| commit | 457c463d8a2c30b006b2be4b9f7913f01a1697eb (patch) | |
| tree | 94c8858e6a26daffdbc52d21607d2ed9e9325dbb | |
| parent | 81156931215c151453205088788c34492e3d1df7 (diff) | |
Notes
| -rw-r--r-- | bin/sh/eval.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index c468e816b6820..a91f9dbab0b56 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -182,6 +182,9 @@ evalstring(char *s) void evaltree(union node *n, int flags) { + int do_etest; + + do_etest = 0; if (n == NULL) { TRACE(("evaltree(NULL) called\n")); exitstatus = 0; @@ -219,6 +222,7 @@ evaltree(union node *n, int flags) break; case NSUBSHELL: evalsubshell(n, flags); + do_etest = !(flags & EV_TESTED); break; case NBACKGND: evalsubshell(n, flags); @@ -256,9 +260,11 @@ evaltree(union node *n, int flags) case NPIPE: evalpipe(n); + do_etest = !(flags & EV_TESTED); break; case NCMD: evalcommand(n, flags, (struct backcmd *)NULL); + do_etest = !(flags & EV_TESTED); break; default: out1fmt("Node type = %d\n", n->type); @@ -268,9 +274,7 @@ evaltree(union node *n, int flags) out: if (pendingsigs) dotrap(); - if ((flags & EV_EXIT) || (eflag && exitstatus - && !(flags & EV_TESTED) && (n->type == NCMD || - n->type == NSUBSHELL))) + if ((flags & EV_EXIT) || (eflag && exitstatus != 0 && do_etest)) exitshell(exitstatus); } |
