From 4bfb5daa7ee0f3d2318ddd244e70fcb169f41e64 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 23 Feb 2011 09:47:05 +0000 Subject: 28795 plus typos noticed by Mikael: careful with forked shells --- Src/exec.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Src/exec.c') 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; } -- cgit 1.4.1