summaryrefslogtreecommitdiffstats
path: root/tools/regression
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-03-03 17:33:59 +0000
committerjilles <jilles@FreeBSD.org>2013-03-03 17:33:59 +0000
commitd0155c5dccc3af5494798ad79b42ad906bfd8671 (patch)
tree8f22588cd3d7dd9680e3d8df2bb3c64c95436187 /tools/regression
parent82dd943a5ebeb1f62f5815e263e3de810e3fbf55 (diff)
downloadFreeBSD-src-d0155c5dccc3af5494798ad79b42ad906bfd8671.zip
FreeBSD-src-d0155c5dccc3af5494798ad79b42ad906bfd8671.tar.gz
sh: When executing a trap, keep exit status along with evalskip.
This ensures 'return' in a trap returns the correct status to the caller. If evalskip is not set or if it is overridden by a previous evalskip, keep the old behaviour of restoring the exit status from before the trap.
Diffstat (limited to 'tools/regression')
-rw-r--r--tools/regression/bin/sh/builtins/trap12.010
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/builtins/trap12.0 b/tools/regression/bin/sh/builtins/trap12.0
new file mode 100644
index 0000000..8c62ffd
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/trap12.0
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+f() {
+ trap 'return 42' USR1
+ kill -USR1 $$
+ return 3
+}
+f
+r=$?
+[ "$r" = 42 ]
OpenPOWER on IntegriCloud