RFR: 8327621: Check return value of uname in os::get_host_name
David Holmes
dholmes at openjdk.org
Mon Mar 11 04:48:52 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
Okay on being defensive - one suggestion below.
src/hotspot/os/posix/os_posix.cpp line 616:
> 614: jio_snprintf(buf, buflen, "%s", name.nodename);
> 615: return true;
> 616: }
Else I suggest printing a warning and reporting the error using os::strerror
-------------
PR Review: https://git.openjdk.org/jdk/pull/18157#pullrequestreview-1926925651
PR Review Comment: https://git.openjdk.org/jdk/pull/18157#discussion_r1519152772
More information about the hotspot-runtime-dev
mailing list