RFR: 8350869: os::stat doesn't follow symlinks on Windows [v3]
Anton Artemov
duke at openjdk.org
Thu May 15 14:11:55 UTC 2025
On Thu, 15 May 2025 13:39:19 GMT, Anton Artemov <duke at openjdk.org> wrote:
>> src/hotspot/os/windows/os_windows.cpp line 4614:
>>
>>> 4612:
>>> 4613: // This method checks if a wide path is actually a symbolic link
>>> 4614: static bool is_symbolic_link(const wchar_t* wide_path)
>>
>> This is a `bool` function but you also set `errno` upon errors - how will anyone know that an error occurred?
>
> I verified, one does not have to set `errno` here, as in both use cases of `is_symbolic_link()` the further code in `os::stat()` and `os::open()` checks a return value of a corresponding method and returns -1 in case of a problem. By this one knows that something went wrong.
>
> In this particular place one only needs to close a search handle by calling `FindClose()`.
The only explicit way how to notify about the error I found is like this:
`log_info(os)("CreateFileMapping() failed: GetLastError->%ld.", GetLastError());`
Then one would not presumably need to set `errno`.
The question is rather if we want to see this message or just rely on the existing logic.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25233#discussion_r2091266994
More information about the hotspot-runtime-dev
mailing list