On Mon, 3 Oct 2022 13:37:38 GMT, Julian Waters <jwat...@openjdk.org> wrote:
>> A large section of error reporting code in the JDK does not properly handle >> WIN32 API errors and instead mixes them with errors originating from C. >> Since they can be rather easily replaced and coming up with an elegant >> solution proved to be too much of a hassle to be worth it, and some of the >> concerns they address no longer are an issue with current versions of the >> platforms supported by the JDK, they can be easily removed without much >> effect. The remaining utilities that are still needed now instead report >> directly from strerror, with a new subsystem for WIN32 errors put in place >> wherever required, to minimize confusion when they are used, which was a >> problem with earlier solutions to this issue. > > Julian Waters has updated the pull request incrementally with one additional > commit since the last revision: > > Naming Please, move code like one below to a separate function rather than spreading #ifdef _WIN32 all over the code. #ifdef _WIN32 /* The implementation on Windows uses the Windows API */ char buf[256]; size_t n = getLastWinErrorString(buf, sizeof(buf)); if (n > 0) { #else char* buf = NULL; const int error = errno; if (error != 0) buf = strerror(error); if (buf != NULL) { #endif ------------- Changes requested by dsamersoff (Reviewer). PR: https://git.openjdk.org/jdk/pull/9870