At least on NetBSD 5.0_STABLE with Libtool 2.2.6b, lt_dlerror() can
sometimes return NULL, so be sure to handle that case properly. This commit was SVN r23503.
Этот коммит содержится в:
родитель
245dc1a86d
Коммит
88b7923fc5
@ -503,27 +503,33 @@ static int open_component(component_file_item_t *target_file,
|
|||||||
component_handle = lt_dlopenext(target_file->filename);
|
component_handle = lt_dlopenext(target_file->filename);
|
||||||
#endif
|
#endif
|
||||||
if (NULL == component_handle) {
|
if (NULL == component_handle) {
|
||||||
err = strdup(lt_dlerror());
|
/* Apparently lt_dlerror() sometimes returns NULL! */
|
||||||
/* Because libltdl erroneously says "file not found" for any type
|
const char *str = lt_dlerror();
|
||||||
of error -- which is especially misleading when the file is
|
if (NULL != str) {
|
||||||
actually there but cannot be opened for some other reason
|
err = strdup(str);
|
||||||
(e.g., missing symbol) -- do some simple huersitics and if the
|
} else {
|
||||||
file [probably] does exist, print a slightly better error
|
err = strdup("lt_dlerror() returned NULL!");
|
||||||
message. */
|
}
|
||||||
if (0 == strcmp("file not found", err) &&
|
/* Because libltdl erroneously says "file not found" for any
|
||||||
(file_exists(target_file->filename, "lo") ||
|
type of error -- which is especially misleading when the file
|
||||||
file_exists(target_file->filename, "so") ||
|
is actually there but cannot be opened for some other reason
|
||||||
file_exists(target_file->filename, "dylib") ||
|
(e.g., missing symbol) -- do some simple huersitics and if
|
||||||
file_exists(target_file->filename, "dll"))) {
|
the file [probably] does exist, print a slightly better error
|
||||||
free(err);
|
message. */
|
||||||
err = strdup("perhaps a missing symbol, or compiled for a different version of Open MPI?");
|
if (0 == strcmp("file not found", err) &&
|
||||||
}
|
(file_exists(target_file->filename, "lo") ||
|
||||||
opal_output_verbose(vl, 0, "mca: base: component_find: unable to open %s: %s (ignored)",
|
file_exists(target_file->filename, "so") ||
|
||||||
target_file->filename, err);
|
file_exists(target_file->filename, "dylib") ||
|
||||||
free(err);
|
file_exists(target_file->filename, "dll"))) {
|
||||||
target_file->status = FAILED_TO_LOAD;
|
free(err);
|
||||||
free_dependency_list(&dependencies);
|
err = strdup("perhaps a missing symbol, or compiled for a different version of Open MPI?");
|
||||||
return OPAL_ERR_BAD_PARAM;
|
}
|
||||||
|
opal_output_verbose(vl, 0, "mca: base: component_find: unable to open %s: %s (ignored)",
|
||||||
|
target_file->filename, err);
|
||||||
|
free(err);
|
||||||
|
target_file->status = FAILED_TO_LOAD;
|
||||||
|
free_dependency_list(&dependencies);
|
||||||
|
return OPAL_ERR_BAD_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Successfully opened the component; now find the public struct.
|
/* Successfully opened the component; now find the public struct.
|
||||||
@ -551,15 +557,20 @@ static int open_component(component_file_item_t *target_file,
|
|||||||
|
|
||||||
component_struct = (mca_base_component_t*)lt_dlsym(component_handle, struct_name);
|
component_struct = (mca_base_component_t*)lt_dlsym(component_handle, struct_name);
|
||||||
if (NULL == component_struct) {
|
if (NULL == component_struct) {
|
||||||
opal_output_verbose(vl, 0, "mca: base: component_find: \"%s\" does not appear to be a valid "
|
/* Apparently lt_dlerror() sometimes returns NULL! */
|
||||||
"%s MCA dynamic component (ignored): %s",
|
const char *str = lt_dlerror();
|
||||||
target_file->basename, target_file->type, lt_dlerror());
|
if (NULL == str) {
|
||||||
free(mitem);
|
str = "lt_dlerror() returned NULL!";
|
||||||
free(struct_name);
|
}
|
||||||
lt_dlclose(component_handle);
|
opal_output_verbose(vl, 0, "mca: base: component_find: \"%s\" does not appear to be a valid "
|
||||||
target_file->status = FAILED_TO_LOAD;
|
"%s MCA dynamic component (ignored): %s",
|
||||||
free_dependency_list(&dependencies);
|
target_file->basename, target_file->type, str);
|
||||||
return OPAL_ERR_BAD_PARAM;
|
free(mitem);
|
||||||
|
free(struct_name);
|
||||||
|
lt_dlclose(component_handle);
|
||||||
|
target_file->status = FAILED_TO_LOAD;
|
||||||
|
free_dependency_list(&dependencies);
|
||||||
|
return OPAL_ERR_BAD_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We found the public struct. Make sure its MCA major.minor
|
/* We found the public struct. Make sure its MCA major.minor
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user