misc: move exit status into trap handler
authorDarrick J. Wong <djwong@kernel.org>
Mon, 21 Jun 2021 15:54:53 +0000 (08:54 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 27 Jun 2021 14:49:33 +0000 (22:49 +0800)
Move the "exit $status" clause of the _cleanup function into the
argument to the "trap" command so that we can standardize the
registration of the atexit cleanup code in the next few patches.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/068
tests/xfs/004

index 932a856..573fbd4 100755 (executable)
@@ -22,10 +22,9 @@ _cleanup()
     cd /
 
     trap 0 1 2 3 15
-    exit $status
 }
 
-trap "_cleanup" 0 1 2 3 15
+trap "_cleanup; exit \$status" 0 1 2 3 15
 
 # get standard environment, filters and checks
 . ./common/rc
index d3fb9c9..4d92a08 100755 (executable)
@@ -18,9 +18,8 @@ _cleanup()
 {
        _scratch_unmount
        rm -f $tmp.*
-       exit $status
 }
-trap "_cleanup" 0 1 2 3 15
+trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _populate_scratch()
 {