]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
posix: Add cleanup on the trap list for globtest.sh
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 11 Apr 2017 18:08:02 +0000 (15:08 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 20 Apr 2017 17:59:22 +0000 (14:59 -0300)
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.

Cherry-pick of 4fee33f.

ChangeLog
posix/globtest.sh

index 17f386e257980adc93fd6ef6ff2c4152826a360b..aac7add8856e1b4cc44a33dbd4f4a83639299cdb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-04-11  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       * posix/globtest.sh: Add cleanup routine on trap 0.
+
 2017-03-31  Slava Barinov  <v.barinov@samsung.com>
 
        [BZ #21289]
index 73fe11bd76dbea1c170e22c294276b61e687f918..85a345595309d80655a18109090cac0ff59099b1 100755 (executable)
@@ -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
@@ -795,8 +800,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