提交 8409dea5 编写于 作者: S sla

8009397: test/com/sun/jdi/PrivateTransportTest.sh: ERROR: transport library...

8009397: test/com/sun/jdi/PrivateTransportTest.sh: ERROR: transport library missing onLoad entry: private_dt_socket
Reviewed-by: alanb
上级 2bfe9aaa
...@@ -117,6 +117,9 @@ loadTransportLibrary(char *libdir, char *name) ...@@ -117,6 +117,9 @@ loadTransportLibrary(char *libdir, char *name)
/* Construct library name (simple name or full path) */ /* Construct library name (simple name or full path) */
dbgsysBuildLibName(libname, sizeof(libname), plibdir, name); dbgsysBuildLibName(libname, sizeof(libname), plibdir, name);
if (strlen(libname) == 0) {
return NULL;
}
/* dlopen (unix) / LoadLibrary (windows) the transport library */ /* dlopen (unix) / LoadLibrary (windows) the transport library */
handle = dbgsysLoadLibrary(libname, buf, sizeof(buf)); handle = dbgsysLoadLibrary(libname, buf, sizeof(buf));
......
...@@ -1899,11 +1899,17 @@ load_library(char *name) ...@@ -1899,11 +1899,17 @@ load_library(char *name)
*/ */
getSystemProperty("sun.boot.library.path", &boot_path); getSystemProperty("sun.boot.library.path", &boot_path);
md_build_library_name(lname, FILENAME_MAX, boot_path, name); md_build_library_name(lname, FILENAME_MAX, boot_path, name);
if ( strlen(lname) == 0 ) {
HPROF_ERROR(JNI_TRUE, "Could not find library");
}
jvmtiDeallocate(boot_path); jvmtiDeallocate(boot_path);
handle = md_load_library(lname, err_buf, (int)sizeof(err_buf)); handle = md_load_library(lname, err_buf, (int)sizeof(err_buf));
if ( handle == NULL ) { if ( handle == NULL ) {
/* This may be necessary on Windows. */ /* This may be necessary on Windows. */
md_build_library_name(lname, FILENAME_MAX, "", name); md_build_library_name(lname, FILENAME_MAX, "", name);
if ( strlen(lname) == 0 ) {
HPROF_ERROR(JNI_TRUE, "Could not find library");
}
handle = md_load_library(lname, err_buf, (int)sizeof(err_buf)); handle = md_load_library(lname, err_buf, (int)sizeof(err_buf));
if ( handle == NULL ) { if ( handle == NULL ) {
HPROF_ERROR(JNI_TRUE, err_buf); HPROF_ERROR(JNI_TRUE, err_buf);
...@@ -1968,6 +1974,9 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) ...@@ -1968,6 +1974,9 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
getSystemProperty("sun.boot.library.path", &boot_path); getSystemProperty("sun.boot.library.path", &boot_path);
/* Load in NPT library for character conversions */ /* Load in NPT library for character conversions */
md_build_library_name(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME); md_build_library_name(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME);
if ( strlen(npt_lib) == 0 ) {
HPROF_ERROR(JNI_TRUE, "Could not find npt library");
}
jvmtiDeallocate(boot_path); jvmtiDeallocate(boot_path);
NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL); NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL);
if ( gdata->npt == NULL ) { if ( gdata->npt == NULL ) {
......
...@@ -60,6 +60,7 @@ static void dll_build_name(char* buffer, size_t buflen, ...@@ -60,6 +60,7 @@ static void dll_build_name(char* buffer, size_t buflen,
char *path_sep = PATH_SEPARATOR; char *path_sep = PATH_SEPARATOR;
char *pathname = (char *)pname; char *pathname = (char *)pname;
*buffer = '\0';
while (strlen(pathname) > 0) { while (strlen(pathname) > 0) {
char *p = strchr(pathname, *path_sep); char *p = strchr(pathname, *path_sep);
if (p == NULL) { if (p == NULL) {
...@@ -69,13 +70,17 @@ static void dll_build_name(char* buffer, size_t buflen, ...@@ -69,13 +70,17 @@ static void dll_build_name(char* buffer, size_t buflen,
if (p == pathname) { if (p == pathname) {
continue; continue;
} }
(void)snprintf(buffer, buflen, "%.*s/lib%s." LIB_SUFFIX, (p - pathname), (void)snprintf(buffer, buflen, "%.*s/lib%s." LIB_SUFFIX, (int)(p - pathname),
pathname, fname); pathname, fname);
if (access(buffer, F_OK) == 0) { if (access(buffer, F_OK) == 0) {
break; break;
} }
pathname = p + 1; if (*p == '\0') {
pathname = p;
} else {
pathname = p + 1;
}
*buffer = '\0'; *buffer = '\0';
} }
} }
......
...@@ -385,6 +385,7 @@ static void dll_build_name(char* buffer, size_t buflen, ...@@ -385,6 +385,7 @@ static void dll_build_name(char* buffer, size_t buflen,
// Loosely based on os_solaris.cpp // Loosely based on os_solaris.cpp
char *pathname = (char *)pname; char *pathname = (char *)pname;
*buffer = '\0';
while (strlen(pathname) > 0) { while (strlen(pathname) > 0) {
char *p = strchr(pathname, ':'); char *p = strchr(pathname, ':');
if (p == NULL) { if (p == NULL) {
...@@ -395,12 +396,16 @@ static void dll_build_name(char* buffer, size_t buflen, ...@@ -395,12 +396,16 @@ static void dll_build_name(char* buffer, size_t buflen,
continue; continue;
} }
(void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX, (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX,
(p - pathname), pathname, fname); (int)(p - pathname), pathname, fname);
if (access(buffer, F_OK) == 0) { if (access(buffer, F_OK) == 0) {
break; break;
}
if (*p == '\0') {
pathname = p;
} else {
pathname = p + 1;
} }
pathname = p + 1;
*buffer = '\0'; *buffer = '\0';
} }
} }
......
...@@ -44,6 +44,7 @@ static void dll_build_name(char* buffer, size_t buflen, ...@@ -44,6 +44,7 @@ static void dll_build_name(char* buffer, size_t buflen,
char *path_sep = PATH_SEPARATOR; char *path_sep = PATH_SEPARATOR;
char *pathname = (char *)pname; char *pathname = (char *)pname;
*buffer = '\0';
while (strlen(pathname) > 0) { while (strlen(pathname) > 0) {
char *p = strchr(pathname, *path_sep); char *p = strchr(pathname, *path_sep);
if (p == NULL) { if (p == NULL) {
...@@ -54,16 +55,20 @@ static void dll_build_name(char* buffer, size_t buflen, ...@@ -54,16 +55,20 @@ static void dll_build_name(char* buffer, size_t buflen,
continue; continue;
} }
if (*(p-1) == ':' || *(p-1) == '\\') { if (*(p-1) == ':' || *(p-1) == '\\') {
(void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname), (void)_snprintf(buffer, buflen, "%.*s%s.dll", (int)(p - pathname),
pathname, fname); pathname, fname);
} else { } else {
(void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname), (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (int)(p - pathname),
pathname, fname); pathname, fname);
} }
if (_access(buffer, 0) == 0) { if (_access(buffer, 0) == 0) {
break; break;
} }
pathname = p + 1; if (*p == '\0') {
pathname = p;
} else {
pathname = p + 1;
}
*buffer = '\0'; *buffer = '\0';
} }
} }
......
...@@ -372,6 +372,7 @@ static void dll_build_name(char* buffer, size_t buflen, ...@@ -372,6 +372,7 @@ static void dll_build_name(char* buffer, size_t buflen,
// Loosley based on os_windows.cpp // Loosley based on os_windows.cpp
char *pathname = (char *)pname; char *pathname = (char *)pname;
*buffer = '\0';
while (strlen(pathname) > 0) { while (strlen(pathname) > 0) {
char *p = strchr(pathname, ';'); char *p = strchr(pathname, ';');
if (p == NULL) { if (p == NULL) {
...@@ -382,16 +383,20 @@ static void dll_build_name(char* buffer, size_t buflen, ...@@ -382,16 +383,20 @@ static void dll_build_name(char* buffer, size_t buflen,
continue; continue;
} }
if (*(p-1) == ':' || *(p-1) == '\\') { if (*(p-1) == ':' || *(p-1) == '\\') {
(void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname), (void)_snprintf(buffer, buflen, "%.*s%s.dll", (int)(p - pathname),
pathname, fname); pathname, fname);
} else { } else {
(void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname), (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (int)(p - pathname),
pathname, fname); pathname, fname);
} }
if (_access(buffer, 0) == 0) { if (_access(buffer, 0) == 0) {
break; break;
} }
pathname = p + 1; if (*p == '\0') {
pathname = p;
} else {
pathname = p + 1;
}
*buffer = '\0'; *buffer = '\0';
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册