[LTP] [PATCH v2 2/2] Add shutdown02 test

Andrea Cervesato andrea.cervesato@suse.com
Mon Jun 10 16:07:03 CEST 2024


Hi Petr,

On 6/10/24 15:44, Petr Vorel wrote:
> Hi Andrea,
>
> ...
>> +static int file_desc = -1;
>> +static int valid_sock = -1;
>> +static int invalid_sock = -1;
> FYI many LTP tests (or even lib/tst_cgroup.c) just expect that 0 is for stdin,
> thus they happily expect 0 is invalid). e.g.
>
> static int file_desc;
>
> Then in cleanup:
> if (valid_sock > 0)
> 	SAFE_CLOSE(valid_sock);
>
> Sure, your way is correct, but I'd be also OK with 0.
>
> (SAFE_SOCKET() and SAFE_CLOSE() also checks it should be >= 0 for valid file
> descriptor or just -1 for error).
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> Kind regards,
> Petr

I will fix it now

Andrea



More information about the ltp mailing list