All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] quotactl06: Fix tmpdir cleanup if setup() exits early
@ 2022-03-04 10:50 Martin Doucha
  2022-03-04 11:00 ` xuyang2018.jy
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Doucha @ 2022-03-04 10:50 UTC (permalink / raw)
  To: Yang Xu, ltp

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 = {
-- 
2.35.1


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v2] quotactl06: Fix tmpdir cleanup if setup() exits early
  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
  2022-03-10  6:50   ` xuyang2018.jy
  0 siblings, 1 reply; 3+ messages in thread
From: xuyang2018.jy @ 2022-03-04 11:00 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp@lists.linux.it

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v2] quotactl06: Fix tmpdir cleanup if setup() exits early
  2022-03-04 11:00 ` xuyang2018.jy
@ 2022-03-10  6:50   ` xuyang2018.jy
  0 siblings, 0 replies; 3+ messages in thread
From: xuyang2018.jy @ 2022-03-10  6:50 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp@lists.linux.it

Hi Martin

Merged this patchset, thanks.

Best Regards
Yang Xu
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-10  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2022-03-10  6:50   ` xuyang2018.jy

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.