[klibc] [klibc:update-dash] [EVAL] Do not clobber exitstatus in evalcommand

klibc-bot for Herbert Xu herbert at gondor.apana.org.au
Thu Jan 24 19:15:17 PST 2019


Commit-ID:  1fc5f5a5a8704d47b71b01cc0ab734a4d2976d37
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=1fc5f5a5a8704d47b71b01cc0ab734a4d2976d37
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Fri, 3 Oct 2014 14:07:07 +0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 25 Jan 2019 02:57:21 +0000

[klibc] [EVAL] Do not clobber exitstatus in evalcommand

All originators of EXERROR have been setting the exitstatus for
a while now.  So it is no longer appropriate to set it explicitly
in evalcommand.

In fact doing so may cause the original exitstatus to be lost.

Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/eval.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index 501d47fe..b384cb82 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -853,12 +853,9 @@ bail:
 				listsetvar(varlist.list, VEXPORT);
 		}
 		if (evalbltin(cmdentry.u.cmd, argc, argv, flags)) {
-			if (exception == EXERROR) {
-				exitstatus = 2;
-				if (spclbltin <= 0) {
-					FORCEINTON;
-					break;
-				}
+			if (exception == EXERROR && spclbltin <= 0) {
+				FORCEINTON;
+				break;
 			}
 raise:
 			longjmp(handler->loc, 1);


More information about the klibc mailing list