RFR: 8364816: GetLastError() in os_windows.cpp should not store value to errno [v8]

duke duke at openjdk.org
Tue Sep 2 08:06:48 UTC 2025


On Tue, 2 Sep 2025 07:31:28 GMT, Anton Artemov <duke at openjdk.org> wrote:

>> Hi, please consider the following changes:
>> 
>> In `os_windows.cpp` in a few places results returned by `GetLastError()` are stored to `errno`. However, `errno` has no relation to `GetLastError()`, and their ranges are not the same.
>> 
>> Results of `GetLastError()` should be stored into variables of type `DWORD`.
>> 
>> The removed section in `src/hotspot/share/cds/aotClassLocation.cpp` was relying on values returned by `GetLastError()` and stored to `errno` in `os::stat()`. Though the logic was correct, these values should not be stored to `errno`. The functionality is preserved by storing a **valid** value `ENOENT` to `errno` in `os::stat()`. 
>> 
>> Tested in tiers 1 - 3.
>
> Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update src/hotspot/os/windows/os_windows.cpp
>   
>   8364816: Changed the way errno is set to zero.
>   
>   Co-authored-by: David Holmes <62092539+dholmes-ora at users.noreply.github.com>

@toxaart 
Your change (at version 9d69ac3c83adcbc54493ee9b5c10a5a0b897e953) is now ready to be sponsored by a Committer.

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

PR Comment: https://git.openjdk.org/jdk/pull/26901#issuecomment-3244240884


More information about the hotspot-runtime-dev mailing list