summary refs log tree commit diff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2010-10-07 10:55:15 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2010-10-07 10:55:15 +0800
commit7f684260a2426ac61c06d2e4822429b00437ae24 (patch)
treed83efa4a89c7bbc607768a49074c3efc9fd91a52
parent[BUILTIN] Fix trailing field bug in read(1) (diff)
downloaddash-7f684260a2426ac61c06d2e4822429b00437ae24.tar.gz
dash-7f684260a2426ac61c06d2e4822429b00437ae24.zip
[BUILTIN] Fix EXEXEC status clobbering
evalcommand always clobbers the exit status in case of an EXEXEC
which means that exec always fails with exit status 2 regardless
of what it actually returns.

This patch adds the missing check for EXEXEC so that the correct
exit status is preserved.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--ChangeLog4
-rw-r--r--src/eval.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1dfe241..2faaedd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-10-07  Herbert Xu <herbert@gondor.apana.org.au>
+
+	* Fix EXEXEC status clobbering.
+
 2010-09-08  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Fix ifsfirst/ifslastp leak.
diff --git a/src/eval.c b/src/eval.c
index 5b8d36b..b966749 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -854,7 +854,7 @@ bail:
 			int i;
 
 			i = exception;
-			if (i == EXEXIT)
+			if (i == EXEXIT || i == EXEXEC)
 				goto raise;
 
 			status = (i == EXINT) ? SIGINT + 128 : 2;