RFR: 8350869: os::stat doesn't follow symlinks on Windows [v3]

Anton Artemov duke at openjdk.org
Tue May 20 12:22:37 UTC 2025


On Tue, 20 May 2025 02:13:36 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> We do not have an expected value here.
>
> Well we could assert that the return value is >= 0  and not < target_path_size

Thanks for bringing this up. I checked the documentation for `GetFinalPathNameByHandleW`, this is a tricky method. When it is called with the null buffer, i.e. in order to get `target_path_size`, it returns the length with the terminating character. But, when you use it for the 2nd time, i.e. with already allocated buffer of sufficient length, it returns the length without the terminating character. So the failure check is `res != target_path_size - 1`. Addressed in the latest commit.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25233#discussion_r2097808585


More information about the hotspot-runtime-dev mailing list