[LTP] [PATCH 3/3] quotactl06: Fix TESTDIR1 cleanup if setup() exits early

Martin Doucha mdoucha@suse.cz
Fri Mar 4 10:24:53 CET 2022


On 04. 03. 22 2:38, xuyang2018.jy@fujitsu.com wrote:
> 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.

If I understand correctly, the file will be created by mount(), even
before setup() gets executed. So if the file doesn't exist during
cleanup(), the error will be valid.

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


More information about the ltp mailing list