mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Factor out _get_library_path().
This commit is contained in:
parent
4bb7474e8a
commit
4bf57acec8
@ -1,5 +1,6 @@
|
||||
Version 2.01.15 -
|
||||
=================================
|
||||
Factor out _get_library_path().
|
||||
Recognise ATA over Ethernet (aoe) devices.
|
||||
|
||||
Version 2.01.14 - 4th August 2005
|
||||
|
@ -22,21 +22,28 @@
|
||||
#include <sys/stat.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
void *load_shared_library(struct config_tree *cft, const char *libname,
|
||||
const char *desc)
|
||||
static void _get_library_path(struct config_tree *cft, const char *libname,
|
||||
char *path, int path_len)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
struct stat info;
|
||||
const char *lib_dir;
|
||||
void *library;
|
||||
|
||||
/* If libname doesn't begin with '/' then use lib_dir/libname,
|
||||
* if present */
|
||||
if (libname[0] == '/' ||
|
||||
!(lib_dir = find_config_str(cft->root, "global/library_dir", 0)) ||
|
||||
(lvm_snprintf(path, sizeof(path), "%s/%s", lib_dir,
|
||||
(lvm_snprintf(path, path_len, "%s/%s", lib_dir,
|
||||
libname) == -1) || stat(path, &info) == -1)
|
||||
strncpy(path, libname, sizeof(path));
|
||||
strncpy(path, libname, path_len);
|
||||
}
|
||||
|
||||
void *load_shared_library(struct config_tree *cft, const char *libname,
|
||||
const char *desc)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
void *library;
|
||||
|
||||
_get_library_path(cft, libname, path, sizeof(path));
|
||||
|
||||
log_very_verbose("Opening shared %s library %s", desc, path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user