comparison src/share/vm/runtime/os.cpp @ 6966:6cb0d32b828b

8001185: parsing of sun.boot.library.path in os::dll_build_name somewhat broken Summary: dll_dir can contain multiple paths, need to parse them correctly when loading agents Reviewed-by: dholmes, dlong Contributed-by: bill.pittore@oracle.com
author bpittore
date Wed, 07 Nov 2012 17:53:02 -0500
parents 716c64bda5ba
children 80e866b1d053
comparison
equal deleted inserted replaced
6932:857f3ce858dd 6966:6cb0d32b828b
395 char ebuf[1024]; 395 char ebuf[1024];
396 396
397 // Try to load verify dll first. In 1.3 java dll depends on it and is not 397 // Try to load verify dll first. In 1.3 java dll depends on it and is not
398 // always able to find it when the loading executable is outside the JDK. 398 // always able to find it when the loading executable is outside the JDK.
399 // In order to keep working with 1.2 we ignore any loading errors. 399 // In order to keep working with 1.2 we ignore any loading errors.
400 dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), "verify"); 400 if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
401 dll_load(buffer, ebuf, sizeof(ebuf)); 401 "verify")) {
402 dll_load(buffer, ebuf, sizeof(ebuf));
403 }
402 404
403 // Load java dll 405 // Load java dll
404 dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), "java"); 406 if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
405 _native_java_library = dll_load(buffer, ebuf, sizeof(ebuf)); 407 "java")) {
408 _native_java_library = dll_load(buffer, ebuf, sizeof(ebuf));
409 }
406 if (_native_java_library == NULL) { 410 if (_native_java_library == NULL) {
407 vm_exit_during_initialization("Unable to load native library", ebuf); 411 vm_exit_during_initialization("Unable to load native library", ebuf);
408 } 412 }
409 413
410 #if defined(__OpenBSD__) 414 #if defined(__OpenBSD__)
411 // Work-around OpenBSD's lack of $ORIGIN support by pre-loading libnet.so 415 // Work-around OpenBSD's lack of $ORIGIN support by pre-loading libnet.so
412 // ignore errors 416 // ignore errors
413 dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), "net"); 417 if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
414 dll_load(buffer, ebuf, sizeof(ebuf)); 418 "net")) {
419 dll_load(buffer, ebuf, sizeof(ebuf));
420 }
415 #endif 421 #endif
416 } 422 }
417 static jboolean onLoaded = JNI_FALSE; 423 static jboolean onLoaded = JNI_FALSE;
418 if (onLoaded) { 424 if (onLoaded) {
419 // We may have to wait to fire OnLoad until TLS is initialized. 425 // We may have to wait to fire OnLoad until TLS is initialized.
1154 const char psepchar = *os::path_separator(); 1160 const char psepchar = *os::path_separator();
1155 char* inpath = (char*)NEW_C_HEAP_ARRAY(char, strlen(path) + 1, mtInternal); 1161 char* inpath = (char*)NEW_C_HEAP_ARRAY(char, strlen(path) + 1, mtInternal);
1156 if (inpath == NULL) { 1162 if (inpath == NULL) {
1157 return NULL; 1163 return NULL;
1158 } 1164 }
1159 strncpy(inpath, path, strlen(path)); 1165 strcpy(inpath, path);
1160 int count = 1; 1166 int count = 1;
1161 char* p = strchr(inpath, psepchar); 1167 char* p = strchr(inpath, psepchar);
1162 // Get a count of elements to allocate memory 1168 // Get a count of elements to allocate memory
1163 while (p != NULL) { 1169 while (p != NULL) {
1164 count++; 1170 count++;