return-value check of setsockopt ?

Alan Bateman Alan.Bateman at oracle.com
Tue Nov 14 19:02:13 UTC 2023


On 14/11/2023 15:16, Baesken, Matthias wrote:
>
> Hi, while looking at some net/nio coding, I noticed  that at a lot of 
> places the return value of setsockopt is checked :
>
> https://github.com/search?q=repo%3Aopenjdk%2Fjdk+%22setsockopt%22&type=code 
> <https://github.com/search?q=repo%3Aopenjdk%2Fjdk+%22setsockopt%22&type=code>
>
> but the check is omitted at some places .
>

The setsockopt usages in ping4 and ping6 (Inet4Address.c and 
Inet6Address.c) should probably have checks.

There are a few others where they are set when supported. An argument 
could be made to have these handle other errors. So I think it means 
working through them on a case-by-case basis.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/nio-dev/attachments/20231114/b5887381/attachment-0001.htm>


More information about the nio-dev mailing list