# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../pdksh/pdksh-5.2.14-2.patch # Copyright (C) 2004 - 2005 The T2 SDE Project # Copyright (C) 1998 - 2003 ROCK Linux Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- T2-COPYRIGHT-NOTE-END --- [ ftp://ftp.cs.mun.ca/pub/pdksh/pdksh-5.2.14-patches.2 ] --- ./exec.c.a Mon Jan 29 10:02:13 2001 +++ ./exec.c Mon Jan 29 10:06:57 2001 @@ -76,6 +76,7 @@ { int i; volatile int rv = 0; + volatile int rv_prop = 0; /* rv being propogated or newly generated? */ int pv[2]; char ** volatile ap; char *s, *cp; @@ -157,6 +158,7 @@ case TPAREN: rv = execute(t->left, flags|XFORK); + rv_prop = 1; break; case TPIPE: @@ -275,6 +277,7 @@ rv = execute(t->right, flags & XERROK); else flags |= XERROK; + rv_prop = 1; break; case TBANG: @@ -323,6 +326,7 @@ } } rv = 0; /* in case of a continue */ + rv_prop = 1; if (t->type == TFOR) { while (*ap != NULL) { setstr(global(t->str), *ap++, KSH_SS_UNWIND_ERROR); @@ -334,6 +338,7 @@ for (;;) { if (!(cp = do_selectargs(ap, is_first))) { rv = 1; + rv_prop = 0; break; } is_first = FALSE; @@ -365,6 +370,7 @@ rv = 0; /* in case of a continue */ while ((execute(t->left, XERROK) == 0) == (t->type == TWHILE)) rv = execute(t->right, flags & XERROK); + rv_prop = 1; break; case TIF: @@ -374,6 +380,7 @@ rv = execute(t->left, XERROK) == 0 ? execute(t->right->left, flags & XERROK) : execute(t->right->right, flags & XERROK); + rv_prop = 1; break; case TCASE: @@ -386,10 +393,12 @@ break; Found: rv = execute(t->left, flags & XERROK); + rv_prop = 1; break; case TBRACE: rv = execute(t->left, flags & XERROK); + rv_prop = 1; break; case TFUNCT: @@ -401,6 +410,7 @@ * (allows "ls -l | time grep foo"). */ rv = timex(t, flags & ~XEXEC); + rv_prop = 1; break; case TEXEC: /* an eval'd TCOM */ @@ -428,7 +438,7 @@ quitenv(); /* restores IO */ if ((flags&XEXEC)) unwind(LEXIT); /* exit child */ - if (rv != 0 && !(flags & XERROK)) { + if (rv != 0 && !rv_prop && !(flags & XERROK)) { if (Flag(FERREXIT)) unwind(LERROR); trapsig(SIGERR_);