Module Name: src Committed By: christos Date: Sun Mar 25 17:23:49 UTC 2012
Modified Files: src/bin/ksh: exec.c Log Message: PR/6764: Charles M. Hannum: `trap 0' does not work in ksh subshells. When subshells exit normally, use unwind(LEXIT) instead of unwind(LLEAVE) so that traps get executed. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/ksh/exec.c diff -u src/bin/ksh/exec.c:1.14 src/bin/ksh/exec.c:1.15 --- src/bin/ksh/exec.c:1.14 Sun Oct 16 13:12:11 2011 +++ src/bin/ksh/exec.c Sun Mar 25 13:23:48 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: exec.c,v 1.14 2011/10/16 17:12:11 joerg Exp $ */ +/* $NetBSD: exec.c,v 1.15 2012/03/25 17:23:48 christos Exp $ */ /* * execute command tree @@ -6,7 +6,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: exec.c,v 1.14 2011/10/16 17:12:11 joerg Exp $"); +__RCSID("$NetBSD: exec.c,v 1.15 2012/03/25 17:23:48 christos Exp $"); #endif @@ -457,6 +457,7 @@ comexec(t, tp, ap, flags) int volatile flags; { int i; + int leave = LLEAVE; volatile int rv = 0; register char *cp; register char **lastp; @@ -745,10 +746,11 @@ comexec(t, tp, ap, flags) rv = exchild(&texec, flags, -1); break; } + leave = LEXIT; Leave: if (flags & XEXEC) { exstat = rv; - unwind(LLEAVE); + unwind(leave); } return rv; }