On Tue, 15 Nov 2022 07:13:49 GMT, Kim Barrett <[email protected]> wrote:
>> Xue-Lei Andrew Fan has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> delete swp file
>
> src/hotspot/os/bsd/attachListener_bsd.cpp line 294:
>
>> 292: (atoi(buf) != ATTACH_PROTOCOL_VER)) {
>> 293: char msg[32];
>> 294: os::snprintf(msg, sizeof(msg), "%d\n",
>> ATTACH_ERROR_BADVERSION);
>
> Rather than using `strlen(msg)` in the next line, use the result from
> `os::snprintf`.
The problem with using the return value of os::snprintf() is that we need to
handle the -1 case to prevent the position from running backward. Might be
better to use stringStream instead, which should handle the -1 case
transparently.
-------------
PR: https://git.openjdk.org/jdk/pull/11115