about summary refs log tree commit diff
path: root/Src/init.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2018-10-09 14:38:26 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2018-10-09 14:38:26 +0100
commitbbccbe0c85887bfc15c57a0c5eb97e59f7cb9fa7 (patch)
tree01eda28efd0a0b7eff0da5b69697da61b6d0011f /Src/init.c
parent9ede8c657f498c584d89a8d8ff3b24104711c88c (diff)
downloadzsh-bbccbe0c85887bfc15c57a0c5eb97e59f7cb9fa7.tar.gz
zsh-bbccbe0c85887bfc15c57a0c5eb97e59f7cb9fa7.tar.xz
zsh-bbccbe0c85887bfc15c57a0c5eb97e59f7cb9fa7.zip
43660: extend 43653 when final exit is implicit.
Combine logic for case after committed to exit (shell_exiting) with
case where exit occurred in a function we nee to unwind (exit_pending).

Add sarky note for future generations to be confused at.
Diffstat (limited to 'Src/init.c')
-rw-r--r--Src/init.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Src/init.c b/Src/init.c
index e9e6be9b4..838c2c2d1 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -157,7 +157,7 @@ loop(int toplevel, int justonce)
 		 * Handle that now.
 		 */
 		stopmsg = 1;
-		zexit(exit_pending >> 1, 0);
+		zexit(exit_val, 0);
 	    }
 	    if (tok == LEXERR && !lastval)
 		lastval = 1;
@@ -215,14 +215,14 @@ loop(int toplevel, int justonce)
 	    clearerr(stderr);
 	}
 	if (subsh)		/* how'd we get this far in a subshell? */
-	    exit(lastval);
+	    realexit();
 	if (((!interact || sourcelevel) && errflag) || retflag)
 	    break;
 	if (isset(SINGLECOMMAND) && toplevel) {
 	    dont_queue_signals();
 	    if (sigtrapped[SIGEXIT])
 		dotrap(SIGEXIT);
-	    exit(lastval);
+	    realexit();
 	}
 	if (justonce)
 	    break;
@@ -1358,7 +1358,7 @@ init_misc(char *cmd, char *zsh_name)
 	bshin = fdopen(SHIN, "r");
 	execstring(cmd, 0, 1, "cmdarg");
 	stopmsg = 1;
-	zexit(lastval, 0);
+	zexit(exit_val ? exit_val : lastval, 0);
     }
 
     if (interact && isset(RCS))