summaryrefslogtreecommitdiff
path: root/posix/globtest.sh
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2017-04-11 15:08:02 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2017-04-12 11:01:35 -0300
commit4fee33f8c11447d345b2b1118a98958b54d5fda3 (patch)
tree9b7bae995b0f8bd91a9e879d6da704bc516a7178 /posix/globtest.sh
parentb6a66222096c2c4a93818e86cda1aff1e37ee451 (diff)
posix: Add cleanup on the trap list for globtest.sh
This patch prevents lingering files for SIGSEGV failures by adding a cleanup handler on trap handler. Checked on x86_64-linux-gnu. * posix/globtest.sh: Add cleanup routine on trap 0.
Diffstat (limited to 'posix/globtest.sh')
-rwxr-xr-xposix/globtest.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/posix/globtest.sh b/posix/globtest.sh
index f9cc80b4b5..73f7ae31cc 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -47,7 +47,12 @@ testout=${common_objpfx}posix/globtest-out
rm -rf $testdir $testout
mkdir $testdir
-trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15
+cleanup() {
+ chmod 777 $testdir/noread
+ rm -fr $testdir $testout
+}
+
+trap cleanup 0 HUP INT QUIT TERM
echo 1 > $testdir/file1
echo 2 > $testdir/file2
@@ -811,8 +816,6 @@ if test $failed -ne 0; then
fi
if test $result -eq 0; then
- chmod 777 $testdir/noread
- rm -fr $testdir $testout
echo "All OK." > $logfile
fi