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

klibc-bot for Herbert Xu herbert at gondor.apana.org.au
Sat Mar 28 14:48:20 PDT 2020


Commit-ID:  e49a1160b58933c257c27603aa3d020daf8e0943
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=e49a1160b58933c257c27603aa3d020daf8e0943
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: Sat, 28 Mar 2020 21:42:54 +0000

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

[ dash commit 0d1fb088a4a16569260de4266d4bd359491c6bcd ]

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 b3e971bf..3e08e825 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