RFR: 8327621: Check return value of uname in os::get_host_name
Thomas Stuefe
stuefe at openjdk.org
Mon Mar 11 08:55:54 UTC 2024
On Mon, 11 Mar 2024 04:46:23 GMT, David Holmes <dholmes 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
>
> 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
Bikeshedding, I would just report false, but print a warning using UL, flag "os", with warning level. That will be shown by default, but this is strange enough that users should see this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18157#discussion_r1519338854
More information about the hotspot-runtime-dev
mailing list