about summary refs log tree commit diff
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
parent7c98ca21f5e6131aa21c6d2139627de512d02678 (diff)
downloadzsh-6d0dc9e0eb19fa2ed033d1f7d5f1d848c002a059.tar.gz
zsh-6d0dc9e0eb19fa2ed033d1f7d5f1d848c002a059.tar.xz
zsh-6d0dc9e0eb19fa2ed033d1f7d5f1d848c002a059.zip
23008: failure to output error message could alter exit status
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ec20998a6..93ee5d694 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-11-19  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 23008: Src/exec.c: failure to output error message could
+	alter exit status.
+
 2006-11-18  Clint Adams  <clint@zsh.org>
 
 	* 23005: Completion/Unix/Command/_toilet: completion
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;
 	}