All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] tests: remove temporary file
@ 2025-03-04 15:11 Florian Westphal
  2025-03-05 21:14 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2025-03-04 15:11 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

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>
---
 tests/shell/testcases/include/0002relative_0 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/shell/testcases/include/0002relative_0 b/tests/shell/testcases/include/0002relative_0
index dbf11e7db171..ac8355475320 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"
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-05 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-04 15:11 [PATCH nft] tests: remove temporary file Florian Westphal
2025-03-05 21:14 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.