--- a/src/hotspot/os/linux/os_linux.cpp Fri Jun 07 08:47:28 2019 -0300
+++ b/src/hotspot/os/linux/os_linux.cpp Wed Jun 05 16:53:52 2019 +0200
@@ -1881,8 +1881,17 @@
int ebuflen) {
void * result = ::dlopen(filename, RTLD_LAZY);
if (result == NULL) {
- ::strncpy(ebuf, ::dlerror(), ebuflen - 1);
- ebuf[ebuflen-1] = '\0';
+ const char* error_report = ::dlerror();
+ if (error_report == NULL) {
+ error_report = "dlerror returned no error description";
+ }
+ if (ebuf != NULL && ebuflen > 0) {
+ ::strncpy(ebuf, error_report, ebuflen-1);
+ ebuf[ebuflen-1]='\0';
+ }
+ Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
+ } else {
+ Events::log(NULL, "Loaded shared library %s", filename);
}
return result;
}