RFR: 8333871: check sysinfo return values [v2]

Matthias Baesken mbaesken at openjdk.org
Fri Nov 14 11:07:22 UTC 2025


On Fri, 14 Nov 2025 10:51:23 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   0 - terminate not needed
>
> src/java.base/unix/native/libjava/java_props_md.c line 394:
> 
>> 392:         if (ret == 0) {
>> 393:             sprops.cpu_isalist = strdup(list);
>> 394:             list[sizeof(list) - 1] = '\0';
> 
> Hello Matthias, is this a typo? The assignment to `list` which is no longer used after the previous line where it is duplicated, seems odd. Furthermore, is this explicit null termination needed? In `man strdup` I don't see any such expectations:
> 
>> The strdup() function returns a pointer to a new string which is a duplicate of the string s.  Memory for the new string is obtained with malloc(3), and can be freed with free(3).

Hi , I removed the 0 - termination. Seems it is not needed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28317#discussion_r2527094141


More information about the hotspot-runtime-dev mailing list