[LTP] [PATCH 3/3] quotactl06: Fix TESTDIR1 cleanup if setup() exits early
xuyang2018.jy@fujitsu.com
xuyang2018.jy@fujitsu.com
Fri Mar 4 02:38:06 CET 2022
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 = {
More information about the ltp
mailing list