From: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
To: Martin Doucha <mdoucha@suse.cz>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2] quotactl06: Fix tmpdir cleanup if setup() exits early
Date: Fri, 4 Mar 2022 11:00:34 +0000 [thread overview]
Message-ID: <6221F178.2020404@fujitsu.com> (raw)
In-Reply-To: <20220304105034.22083-1-mdoucha@suse.cz>
Hi Martin
Looks good to me,
Reviewed-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Best Regards
Yang Xu
> When setup() exits with TCONF before USRPATH or TESTDIR1 get created,
> cleanup() will trigger TWARN when it tries to delete them. Check whether
> the file and directory exists before removing them.
>
> Signed-off-by: Martin Doucha<mdoucha@suse.cz>
> ---
>
> Changes since v1:
> - Also check whether USRPATH exists before deleting it
>
> testcases/kernel/syscalls/quotactl/quotactl06.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c
> index 8e9a17393..87715237f 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl06.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
> @@ -206,8 +206,11 @@ static void setup(void)
>
> static void cleanup(void)
> {
> - SAFE_UNLINK(USRPATH);
> - SAFE_RMDIR(TESTDIR1);
> + if (!access(USRPATH, F_OK))
> + SAFE_UNLINK(USRPATH);
> +
> + if (!access(TESTDIR1, F_OK))
> + SAFE_RMDIR(TESTDIR1);
> }
>
> static struct tst_test test = {
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-03-04 11:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 10:50 [LTP] [PATCH v2] quotactl06: Fix tmpdir cleanup if setup() exits early Martin Doucha
2022-03-04 11:00 ` xuyang2018.jy [this message]
2022-03-10 6:50 ` xuyang2018.jy
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=6221F178.2020404@fujitsu.com \
--to=xuyang2018.jy@fujitsu.com \
--cc=ltp@lists.linux.it \
--cc=mdoucha@suse.cz \
/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