diff mbox

[v2,2/12] main: Only set savestatus in exitcmd

Message ID E1fITaF-0000UR-Vh@gondobar (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show

Commit Message

Herbert Xu May 15, 2018, 6:37 a.m. UTC
Currently exitcmd sets exitstatus and then savestatus if the latter
was previously set.  In fact, as exitcmd always raises an exception
and will either end up in the setjmp call in main() or exitshell(),
where exitstatus is always replaced by savestatus if set, we only
need to set savestatus.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---

 src/main.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/main.c b/src/main.c
index fcd3e7d..9f03717 100644
--- a/src/main.c
+++ b/src/main.c
@@ -339,13 +339,8 @@  exitcmd(int argc, char **argv)
 	if (stoppedjobs())
 		return 0;
 
-	if (argc > 1) {
-		int status = number(argv[1]);
-
-		exitstatus = status;
-		if (savestatus >= 0)
-			savestatus = status;
-	}
+	if (argc > 1)
+		savestatus = number(argv[1]);
 
 	exraise(EXEXIT);
 	/* NOTREACHED */