RFR: 8346059: [ASAN] awt_LoadLibrary.c reported compile warning ignoring return value of function by clang17

Magnus Ihse Bursie ihse at openjdk.org
Thu Dec 12 10:31:36 UTC 2024


On Thu, 12 Dec 2024 04:32:14 GMT, SendaoYan <syan at 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?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22701#discussion_r1881802079


More information about the client-libs-dev mailing list