about summary refs log tree commit diff
path: root/Src/signals.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-01-12 23:10:15 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-01-12 23:10:15 +0000
commitb4a7ad8269676f0fa281dab1ca1d09ed2a93a799 (patch)
treecc8668ca03b61166ce2b1267b93010e3ec9bb99c /Src/signals.c
parente8b56578db3d971b18d59a5c579ae19b70ec50a1 (diff)
downloadzsh-b4a7ad8269676f0fa281dab1ca1d09ed2a93a799.tar.gz
zsh-b4a7ad8269676f0fa281dab1ca1d09ed2a93a799.tar.xz
zsh-b4a7ad8269676f0fa281dab1ca1d09ed2a93a799.zip
23101: various combinations of ZERR with function returns were feature-ridden
Diffstat (limited to 'Src/signals.c')
-rw-r--r--Src/signals.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Src/signals.c b/Src/signals.c
index 635a7d341..8478fdd30 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -1071,6 +1071,7 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
     char *name, num[4];
     int trapret = 0;
     int obreaks = breaks;
+    int oretflag = retflag;
     int isfunc;
     int traperr;
 
@@ -1109,7 +1110,7 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
 
     lexsave();
     execsave();
-    breaks = 0;
+    breaks = retflag = 0;
     runhookdef(BEFORETRAPHOOK, NULL);
     if (*sigtr & ZSIG_FUNC) {
 	int osc = sfcontext;
@@ -1176,15 +1177,20 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
 	if (isfunc) {
 	    breaks = loops;
 	    errflag = 1;
+	    lastval = trapret;
 	} else {
 	    lastval = trapret-1;
 	}
+	/* return triggered */
+	retflag = 1;
     } else {
 	if (traperr && emulation != EMULATE_SH)
 	    lastval = 1;
 	if (try_tryflag)
 	    errflag = traperr;
 	breaks += obreaks;
+	/* return not triggered: restore old flag */
+	retflag = oretflag;
 	if (breaks > loops)
 	    breaks = loops;
     }