RFR: 8346059: [ASAN] awt_LoadLibrary.c reported compile warning ignoring return value of function by clang17
SendaoYan
syan at openjdk.org
Fri Dec 13 03:28:36 UTC 2024
On Thu, 12 Dec 2024 19:53:12 GMT, Phil Race <prr at openjdk.org> wrote:
>> src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c line 141:
>>
>>> 139: dladdr((void *)AWT_OnLoad, &dlinfo);
>>> 140: if (realpath((char *)dlinfo.dli_fname, buf) == NULL) {
>>> 141: perror((char *)dlinfo.dli_fname);
>>
>> Having error handling is better than no error handling, but is `perror` the best we can do?
>>
>> OTOH, maybe it doesn't matter as much. Something would be very, very broken if this were to fail.
>
> I saw this in another bug report too from the same submitter.
> I don't know that I want to encourage this as a pattern, except in debug builds. better might be to just copy dlinfo.dli_fname into buf ..
`perror` will print the given message accrording the previous `errno` info to stderr, so this change will not change the original behaviour.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22701#discussion_r1883201733
More information about the client-libs-dev
mailing list