RFR: 8343191: Cgroup v1 subsystem fails to set subsystem path [v11]
    Sergey Chernyshev 
    schernyshev at openjdk.org
       
    Fri Feb 21 20:07:58 UTC 2025
    
    
  
On Thu, 20 Feb 2025 17:32:54 GMT, Sergey Chernyshev <schernyshev at openjdk.org> wrote:
>> src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1SubsystemController.java line 73:
>> 
>>> 71:                                 break;
>>> 72:                             }
>>> 73:                             cgp = (cgp.getNameCount() > 1) ? cgp.subpath(1, cgp.getNameCount()) : Path.of("");
>> 
>> Suggestion:
>> 
>>                             cgp = (nameCount > 1) ? cgp.subpath(1, nameCount) : Path.of("");
>
> Good catch, but as long as cgp#nameCount may change in the loop, this exact patch i cannot take.
How about this?
int currentNameCount = cgp.getNameCount();
cgp = (currentNameCount > 1) ? cgp.subpath(1, currentNameCount) : Path.of("");
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21808#discussion_r1966107031
    
    
More information about the serviceability-dev
mailing list