RFR: 8337506: Disable "best-fit" mapping on Windows command line

Naoto Sato naoto at openjdk.org
Fri Aug 2 18:04:30 UTC 2024


On Fri, 2 Aug 2024 17:53:17 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> IIUC, all errors should be handled with the proposed patch. On error with JLI_MemAlloc and WideCharToMultiByte, the process exits with `exit(1)`. As to `GetCommandLineW()`, there is no description of error in the MS document (https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-getcommandlinew), so I suppose no error handling on our side is needed.
>
>> IIUC, all errors should be handled with the proposed patch. On error with JLI_MemAlloc and WideCharToMultiByte, the process exits with `exit(1)`. 
> 
> I think I'm mostly wondering about WideCharToMultiByte as it returns 0 when it fails.

The first call to `WideCharToMultiByte()` returns the required size for the multibyte buffer. When it returns 0, `exit(1)` is issued inside `JLI_MemAlloc()`. If the second call to `WideCharToMultiByte()` returns 0, it is explicitly dealt with the patch which also issues `exit(1)`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20428#discussion_r1702160635


More information about the core-libs-dev mailing list