* [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* Re: [PATCH nft] tests: remove temporary file
2025-03-04 15:11 [PATCH nft] tests: remove temporary file Florian Westphal
@ 2025-03-05 21:14 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2025-03-05 21:14 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
On Tue, Mar 04, 2025 at 04:11:57PM +0100, Florian Westphal wrote:
> 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 | 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 [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.