summary refs log tree commit diff
diff options
context:
space:
mode:
authorherbert <herbert@gondor.apana.org.au>2005-02-25 22:13:05 +1100
committerHerbert Xu <herbert@gondor.apana.org.au>2005-09-26 18:33:03 +1000
commit2337770e015bd73a8670ac8bc450b03b08d4aa87 (patch)
tree40a83a0bffc22a5e1006be4426a908d4b8150fac
parentSize optimisations with state/s in main(). (diff)
downloaddash-2337770e015bd73a8670ac8bc450b03b08d4aa87.tar.gz
dash-2337770e015bd73a8670ac8bc450b03b08d4aa87.zip
Do not clobber exit status on EXEVAL.
-rw-r--r--src/eval.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index f7f0aeb..29db5c1 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -874,6 +874,12 @@ bail:
 			i = exception;
 			if (i == EXEXIT)
 				goto raise;
+			if (i == EXEVAL) {
+				if (oldlvl == shlvl)
+					goto trap;
+				else
+					goto raise;
+			}
 
 			status = 2;
 			j = 0;
@@ -885,11 +891,11 @@ bail:
 				status = j + 128;
 			exitstatus = status;
 
-			if (i == EXINT || (i != EXEVAL && spclbltin > 0) ||
-			    oldlvl != shlvl) {
+			if (i == EXINT || spclbltin > 0) {
 raise:
 				longjmp(handler->loc, 1);
 			}
+trap:
 			FORCEINTON;
 		}
 		break;