aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-02-14 17:32:22 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-02-16 19:14:45 +0100
commit970470e235fd2a00d4b020378ddccf769ce534ec (patch)
treef27dc4e837664f7e935eba76bf9491bdd74a7fd2
parent4ccddc8fb37b7f585c2d62f6e61ad17295399aff (diff)
downloadbusybox-w32-970470e235fd2a00d4b020378ddccf769ce534ec.tar.gz
busybox-w32-970470e235fd2a00d4b020378ddccf769ce534ec.tar.bz2
busybox-w32-970470e235fd2a00d4b020378ddccf769ce534ec.zip
ash: main: Only set savestatus in exitcmd
Upstream commit: Date: Sat, 19 May 2018 02:39:38 +0800 main: Only set savestatus in exitcmd 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> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 270a338d9..db7dffc72 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13427,13 +13427,8 @@ exitcmd(int argc UNUSED_PARAM, char **argv)
13427 if (stoppedjobs()) 13427 if (stoppedjobs())
13428 return 0; 13428 return 0;
13429 13429
13430 if (argv[1]) { 13430 if (argv[1])
13431 int status = number(argv[1]); 13431 savestatus = number(argv[1]);
13432
13433 exitstatus = status;
13434 if (savestatus >= 0)
13435 savestatus = status;
13436 }
13437 13432
13438 raise_exception(EXEXIT); 13433 raise_exception(EXEXIT);
13439 /* NOTREACHED */ 13434 /* NOTREACHED */