[LTP] [PATCH v2] aio_cancel_7-1: Write into a socket

Martin Doucha mdoucha@suse.cz
Fri Aug 22 16:02:26 CEST 2025


Hi!

On 22. 08. 25 5:00, Li Wang wrote:
>>    +       unsigned int argsize = sizeof(bufsize);
> 
> 
> getsockopt() is prefer to have 'socklen_t *' in optlen so we may need:
> 
>      socklen_t argsize = sizeof(bufsize);

Good point, fixed in v3.

>>    +               close(fds[0]);
>>    +               close(fds[1]);
>>    +               return PTS_UNRESOLVED;
> 
> 
> Maybe we could wrap such cleanup code within cleanup_and_return(),
> then avoid the dup code in many places.
> 
> static int cleanup_and_return(int fds[2], int ret)
> {
>         close(fds[0]);
>         close(fds[1]);
>         return ret;
> }
> 
> return cleanup_and_return(fds, PTS_UNRESOLVED);

I've implemented a cleanup() function slightly differently to also clean 
up aio buffers. Patch v3 sent.

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


More information about the ltp mailing list