On Thu, 5 Nov 2026 15:46:15 GMT, Matthias Baesken <[email protected]> wrote:

>> I think `len >= size` is a failure, not only len == size. See the 
>> documentation of GetFinalPathNameByHandleW 
>> https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew
>> 
>> 'If the function fails because lpszFilePath is too small to hold the string 
>> plus the terminating null character, the return value is the required buffer 
>> size, in TCHARs. This value includes the size of the terminating null 
>> character.'
>> And in case of failure we try again with a larger malloced buffer. Why 
>> should we immediately  return?
>
> Btw. we do the buffer enlargement attempt also here  
> https://github.com/openjdk/jdk/blob/8073b51f4827b66ef056952a5f0a152aee09a92e/src/java.base/windows/native/libjava/WinNTFileSystem_md.c#L91

Thanks for the explanation. It makes sense.

I find it hard to see what cause the error condition. Maybe it's better to 
change the comment to


} else {
  // Either of the above GetFinalPathNameByHandleW() calls has failed
  ...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33752#discussion_r4482876204

Reply via email to