summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-11-19 21:34:58 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-11-19 21:34:58 +0000
commit6d0dc9e0eb19fa2ed033d1f7d5f1d848c002a059 (patch)
tree9d984920c686466d62ba46073e520cc94ef10133 /Src
parent7c98ca21f5e6131aa21c6d2139627de512d02678 (diff)
downloadzsh-6d0dc9e0eb19fa2ed033d1f7d5f1d848c002a059.tar.gz
zsh-6d0dc9e0eb19fa2ed033d1f7d5f1d848c002a059.tar.xz
zsh-6d0dc9e0eb19fa2ed033d1f7d5f1d848c002a059.zip
23008: failure to output error message could alter exit status
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 9e2ac1477..f4119bcd8 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -522,12 +522,12 @@ execute(LinkList args, int dash, int defpath)
     }
     for (s = arg0; *s; s++)
 	if (*s == '/') {
-	    errno = zexecve(arg0, argv);
+	    int lerrno = zexecve(arg0, argv);
 	    if (arg0 == s || unset(PATHDIRS) ||
 		(arg0[0] == '.' && (arg0 + 1 == s ||
 				    (arg0[1] == '.' && arg0 + 2 == s)))) {
-		zerr("%e: %s", errno, arg0);
-		_exit((errno == EACCES || errno == ENOEXEC) ? 126 : 127);
+		zerr("%e: %s", lerrno, arg0);
+		_exit((lerrno == EACCES || lerrno == ENOEXEC) ? 126 : 127);
 	    }
 	    break;
 	}