about summary refs log tree commit diff
diff options
context:
space:
mode:
-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;
 	}