From: Vitaly Chikunov <vt@altlinux.org>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] Fix removal of TMP by moving cleanup trap into main just after mktemp
Date: Mon, 7 Sep 2020 10:51:09 +0300 [thread overview]
Message-ID: <20200907075109.19194-1-vt@altlinux.org> (raw)
If user have TMP set and run 'runltp -h' their whole TMP dir is removed.
Fixes: https://github.com/linux-test-project/ltp/issues/722
Suggested-by: Cyril Hrubis <metan@ucw.cz>
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
---
runltp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/runltp b/runltp
index 11654ebff..d53ef2941 100755
--- a/runltp
+++ b/runltp
@@ -552,6 +552,8 @@ main()
# write to it as user nobody
export TMPDIR=$TMP
+ trap "cleanup" 0
+
chmod 777 $TMP || \
{
echo "unable to chmod 777 $TMP ... aborting"
@@ -952,7 +954,6 @@ cleanup()
LTP_SCRIPT="$(basename $0)"
if [ "$LTP_SCRIPT" = "runltp" ]; then
- trap "cleanup" 0
setup
main "$@"
fi
--
2.11.0
next reply other threads:[~2020-09-07 7:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-07 7:51 Vitaly Chikunov [this message]
2020-09-07 8:13 ` [LTP] [PATCH] Fix removal of TMP by moving cleanup trap into main just after mktemp Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200907075109.19194-1-vt@altlinux.org \
--to=vt@altlinux.org \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox