8001185: parsing of sun.boot.library.path in os::dll_build_name somewhat broken

Dll_dir can contain multiple paths, need to parse them correctly when loading agents

Reviewed-by: dholmes, dlong
This commit is contained in:
Bill Pittore 2012-11-07 17:53:02 -05:00 committed by Bill Pittore
parent 40d5fa156c
commit dd5c8eb660
9 changed files with 67 additions and 35 deletions

View file

@ -3706,8 +3706,10 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent, const char *on_load_sym
}
} else {
// Try to load the agent from the standard dll directory
os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), name);
library = os::dll_load(buffer, ebuf, sizeof ebuf);
if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
name)) {
library = os::dll_load(buffer, ebuf, sizeof ebuf);
}
#ifdef KERNEL
// Download instrument dll
if (library == NULL && strcmp(name, "instrument") == 0) {
@ -3732,8 +3734,9 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent, const char *on_load_sym
#endif // KERNEL
if (library == NULL) { // Try the local directory
char ns[1] = {0};
os::dll_build_name(buffer, sizeof(buffer), ns, name);
library = os::dll_load(buffer, ebuf, sizeof ebuf);
if (os::dll_build_name(buffer, sizeof(buffer), ns, name)) {
library = os::dll_load(buffer, ebuf, sizeof ebuf);
}
if (library == NULL) {
const char *sub_msg = " on the library path, with error: ";
size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1;