All of lore.kernel.org
 help / color / mirror / Atom feed
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 3/3] quotactl06: Fix TESTDIR1 cleanup if setup() exits early
Date: Fri, 4 Mar 2022 01:38:06 +0000	[thread overview]
Message-ID: <62216DB6.8040202@fujitsu.com> (raw)
In-Reply-To: <20220303153131.3372-3-mdoucha@suse.cz>

Hi Martin
> When setup() exits with TCONF before TESTDIR1 gets created, cleanup() will
> trigger TWARN when it tries to delete it. Check whether the directory exists
> before calling SAFE_RMDIR().
> 
> Signed-off-by: Martin Doucha<mdoucha@suse.cz>
> ---
>   testcases/kernel/syscalls/quotactl/quotactl06.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c
> index 8e9a17393..d470486d5 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl06.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
> @@ -207,7 +207,9 @@ static void setup(void)
>   static void cleanup(void)
>   {
>   	SAFE_UNLINK(USRPATH);
It seems we also should check USRPATH whether existed.

Best Regards
Yang Xu
> -	SAFE_RMDIR(TESTDIR1);
> +
> +	if (!access(TESTDIR1, F_OK))
> +		SAFE_RMDIR(TESTDIR1);
>   }
> 
>   static struct tst_test test = {

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-03-04  1:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 15:31 [LTP] [PATCH 1/3] quotactl06: Replace tst_brk(TFAIL) with TBROK Martin Doucha
2022-03-03 15:31 ` [LTP] [PATCH 2/3] quotactl06: Code style fixes Martin Doucha
2022-03-04  1:36   ` xuyang2018.jy
2022-03-03 15:31 ` [LTP] [PATCH 3/3] quotactl06: Fix TESTDIR1 cleanup if setup() exits early Martin Doucha
2022-03-04  1:38   ` xuyang2018.jy [this message]
2022-03-04  9:24     ` Martin Doucha
2022-03-04 10:00       ` xuyang2018.jy
2022-03-04  1:35 ` [LTP] [PATCH 1/3] quotactl06: Replace tst_brk(TFAIL) with TBROK 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=62216DB6.8040202@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 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.