On Thu, 12 Dec 2024 10:28:57 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:
>> Hi all, >> This PR fix file src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c >> reported compile warning "ignoring return value of function" by clang17, >> which add check the return value of `realpath` function. Risk is low. >> >> Additional testing: >> >> - [x] jtreg tests(include tier1/2/3) on linux-x64 with release build >> - [x] jtreg tests(include tier1/2/3) on linux-x64 with fastdebug build >> - [x] jtreg tests(include tier1/2/3) on linux-aarch64 with release build >> - [x] jtreg tests(include tier1/2/3) on linux-aarch64 with fastdebug build > > 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 .. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22701#discussion_r1882797066