about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-07-29 15:09:51 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-07-29 15:09:51 +0000
commit640bbab78f56c2a51fb3ee1d0f83e3bf0418d8be (patch)
tree8d78905ddc9bd8e2674bedce6bcdfda10ba6c1da /Src/exec.c
parentefe2876d927b5d028031a6023b622be44c5d5b8a (diff)
downloadzsh-640bbab78f56c2a51fb3ee1d0f83e3bf0418d8be.tar.gz
zsh-640bbab78f56c2a51fb3ee1d0f83e3bf0418d8be.tar.xz
zsh-640bbab78f56c2a51fb3ee1d0f83e3bf0418d8be.zip
20221: $LINENO in trap '...' DEBUG was wrong.
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index ee0752035..d1c3bb98e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -787,7 +787,8 @@ execsimple(Estate state)
     if (errflag)
 	return (lastval = 1);
 
-    if (code)
+    /* In evaluated traps, don't modify the line number. */
+    if ((!intrap || trapisfunc) && code)
 	lineno = code - 1;
 
     code = wc_code(*state->pc++);
@@ -1258,7 +1259,8 @@ execpline2(Estate state, wordcode pcode,
     if (breaks || retflag)
 	return;
 
-    if (WC_PIPE_LINENO(pcode))
+    /* In evaluated traps, don't modify the line number. */
+    if ((!intrap || trapisfunc) && WC_PIPE_LINENO(pcode))
 	lineno = WC_PIPE_LINENO(pcode) - 1;
 
     if (pline_level == 1) {