From: Florian Westphal Date: Tue, 4 Mar 2025 15:11:57 +0000 (+0100) Subject: tests: remove temporary file X-Git-Tag: v1.1.2~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd754211e1954581b388099e3e98bc26522c7065;p=thirdparty%2Fnftables.git tests: remove temporary file 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 Acked-by: Pablo Neira Ayuso --- diff --git a/tests/shell/testcases/include/0002relative_0 b/tests/shell/testcases/include/0002relative_0 index dbf11e7d..ac835547 100755 --- a/tests/shell/testcases/include/0002relative_0 +++ b/tests/shell/testcases/include/0002relative_0 @@ -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"