From 0d3a786b7cff90868a586e5e3a491b82589a236d Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Wed, 10 Oct 2018 11:17:58 +0100
Subject: 43669: ensure explicit exit status is used over implicit
---
Src/builtin.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'Src/builtin.c')
diff --git a/Src/builtin.c b/Src/builtin.c
index e01e035cc..8dcdcc024 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5723,7 +5723,7 @@ int exit_val;
void
realexit(void)
{
- exit(exit_val ? exit_val : lastval);
+ exit((shell_exiting || exit_pending) ? exit_val : lastval);
}
/* As realexit(), but call _exit instead */
@@ -5732,7 +5732,7 @@ realexit(void)
void
_realexit(void)
{
- _exit(exit_val ? exit_val : lastval);
+ _exit((shell_exiting || exit_pending) ? exit_val : lastval);
}
/* exit the shell. val is the return value of the shell. *
--
cgit 1.4.1