about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-02-23 09:47:05 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-02-23 09:47:05 +0000
commit4bfb5daa7ee0f3d2318ddd244e70fcb169f41e64 (patch)
tree31d0195778e601bb6c09bd9d50fac126419bc981 /Src/exec.c
parentdbbcbf67cb8a330e5c7d8a40ed4152a53db6b5f8 (diff)
downloadzsh-4bfb5daa7ee0f3d2318ddd244e70fcb169f41e64.tar.gz
zsh-4bfb5daa7ee0f3d2318ddd244e70fcb169f41e64.tar.xz
zsh-4bfb5daa7ee0f3d2318ddd244e70fcb169f41e64.zip
28795 plus typos noticed by Mikael: careful with forked shells
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 25a2eee38..f1b87e152 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3300,14 +3300,16 @@ execcmd(Estate state, int input, int output, int how, int last1)
     if (isset(POSIXBUILTINS) &&
 	(cflags & (BINF_PSPECIAL|BINF_EXEC))) {
 	/*
-	 * For POSIX-compatibile behaviour with special
+	 * For POSIX-compatible behaviour with special
 	 * builtins (including exec which we don't usually
-	 * classify as a builtin, we treat all errors as fatal.
+	 * classify as a builtin) we treat all errors as fatal.
 	 */
 	if (redir_err || errflag) {
 	    if (!isset(INTERACTIVE)) {
-		/* We've already _exit'ed if forked */
-		exit(1);
+		if (forked)
+		    _exit(1);
+		else
+		    exit(1);
 	    }
 	    errflag = 1;
 	}