RFR: 8327621: Check return value of uname in os::get_host_name

David Holmes dholmes at openjdk.org
Fri Mar 8 02:58:54 UTC 2024


On Thu, 7 Mar 2024 18:25:13 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> Hi,
> 
> Trivial bug fix where we didn't check the return value of `uname(2)` on POSIX platforms. I checked callers of `get_host_name` and all wrap the calls in an `if` branch so they already handle failures.
> 
> Regards,
> Johan

Error checking in general is a good thing  but in this case there are no specified failure modes for uname under Posix, and for Linux the only potential error is

 EFAULT buf is not valid

which is obviously not a concern in the code we have.

Did you encounter an error or was this just defensive programming?

-------------

PR Review: https://git.openjdk.org/jdk/pull/18157#pullrequestreview-1923939403


More information about the hotspot-runtime-dev mailing list