mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Use supplied full dso name.
This commit is contained in:
parent
e408d62eaf
commit
4206c3db2e
@ -702,41 +702,27 @@ static int lookup_symbols(void *dl, struct dso_data *data)
|
|||||||
"unregister_device");
|
"unregister_device");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a DSO file name based on its name. */
|
|
||||||
static char *create_dso_file_name(char *dso_name)
|
|
||||||
{
|
|
||||||
char *ret;
|
|
||||||
static char prefix[] = "libdevmapper-event-";
|
|
||||||
static char suffix[] = ".so";
|
|
||||||
|
|
||||||
if ((ret = dm_malloc(strlen(prefix) +
|
|
||||||
strlen(dso_name) +
|
|
||||||
strlen(suffix) + 1)))
|
|
||||||
sprintf(ret, "%s%s%s", prefix, dso_name, suffix);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Load an application specific DSO. */
|
/* Load an application specific DSO. */
|
||||||
static struct dso_data *load_dso(struct message_data *data)
|
static struct dso_data *load_dso(struct message_data *data)
|
||||||
{
|
{
|
||||||
void *dl;
|
void *dl;
|
||||||
struct dso_data *ret = NULL;
|
struct dso_data *ret = NULL;
|
||||||
char *dso_file;
|
|
||||||
|
|
||||||
if (!(dso_file = create_dso_file_name(data->dso_name)))
|
if (!(dl = dlopen(data->dso_name, RTLD_NOW))){
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!(dl = dlopen(dso_file, RTLD_NOW))){
|
|
||||||
log_error("%s\n", dlerror());
|
log_error("%s\n", dlerror());
|
||||||
goto free_dso_file;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(ret = alloc_dso_data(data)))
|
if (!(ret = alloc_dso_data(data))) {
|
||||||
goto close;
|
dlclose(dl);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(lookup_symbols(dl, ret)))
|
if (!(lookup_symbols(dl, ret))) {
|
||||||
goto free_all;
|
free_dso_data(ret);
|
||||||
|
dlclose(dl);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keep handle to close the library once
|
* Keep handle to close the library once
|
||||||
@ -749,17 +735,6 @@ static struct dso_data *load_dso(struct message_data *data)
|
|||||||
LINK_DSO(ret);
|
LINK_DSO(ret);
|
||||||
unlock_mutex();
|
unlock_mutex();
|
||||||
|
|
||||||
goto free_dso_file;
|
|
||||||
|
|
||||||
free_all:
|
|
||||||
free_dso_data(ret);
|
|
||||||
|
|
||||||
close:
|
|
||||||
dlclose(dl);
|
|
||||||
|
|
||||||
free_dso_file:
|
|
||||||
dm_free(dso_file);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user