]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: remove temporary file
authorFlorian Westphal <fw@strlen.de>
Tue, 4 Mar 2025 15:11:57 +0000 (16:11 +0100)
committerFlorian Westphal <fw@strlen.de>
Thu, 6 Mar 2025 03:43:33 +0000 (04:43 +0100)
0002-relative leaves a temporary file in the current working
directory, at the time the "trap" argument is expanded, tmpfile2
isn't set.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/include/0002relative_0

index dbf11e7db1717207de11f8e2cba5a4b396645de9..ac8355475320e84a09a3624bcedd8a30382ffc37 100755 (executable)
@@ -7,9 +7,14 @@ if [ ! -w "$tmpfile1" ] ; then
        exit 77
 fi
 
-trap "rm -rf $tmpfile1 $tmpfile2" EXIT # cleanup if aborted
-set -e
+cleanup()
+{
+       rm -f "$tmpfile1" "$tmpfile2"
+}
+
+trap cleanup EXIT
 
+set -e
 tmpfile2=$(mktemp -p .)
 
 RULESET1="add table x"