Integrated: 8364816: GetLastError() in os_windows.cpp should not store value to errno
Anton Artemov
duke at openjdk.org
Tue Sep 2 08:18:49 UTC 2025
On Fri, 22 Aug 2025 12:34:41 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.
This pull request has now been integrated.
Changeset: 523bc779
Author: Anton Artemov <anton.artemov at oracle.com>
Committer: Joel Sikström <jsikstro at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/523bc77981cfe82956d2176f74917c41788da6db
Stats: 36 lines in 2 files changed: 6 ins; 9 del; 21 mod
8364816: GetLastError() in os_windows.cpp should not store value to errno
Reviewed-by: dholmes, jsikstro
-------------
PR: https://git.openjdk.org/jdk/pull/26901
More information about the hotspot-runtime-dev
mailing list