summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5f3031d)
raw | patch | inline | side by side (parent: 5f3031d)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 18 Apr 2014 12:31:24 +0000 (14:31 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 18 Apr 2014 12:31:24 +0000 (14:31 +0200) |
That is, the name as specified by the user without '::' replaced by '/'.
The latter is only used for loading the shared object by file-name.
The latter is only used for loading the shared object by file-name.
src/core/plugin.c | patch | blob | history |
diff --git a/src/core/plugin.c b/src/core/plugin.c
index a521b89d1f00778233e7465cb3eb25e7692cd74c..45d3940ff2a36b829fd1559f51074d5b6c03c2c0 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
int
sdb_plugin_load(const char *name, const sdb_plugin_ctx_t *plugin_ctx)
{
- char real_name[name ? strlen(name) + 1 : 1];
+ char base_name[name ? strlen(name) + 1 : 1];
const char *name_ptr;
char *tmp;
if ((! name) || (! *name))
return -1;
- real_name[0] = '\0';
+ base_name[0] = '\0';
name_ptr = name;
while ((tmp = strstr(name_ptr, "::"))) {
- strncat(real_name, name_ptr, (size_t)(tmp - name_ptr));
- strcat(real_name, "/");
+ strncat(base_name, name_ptr, (size_t)(tmp - name_ptr));
+ strcat(base_name, "/");
name_ptr = tmp + strlen("::");
}
- strcat(real_name, name_ptr);
+ strcat(base_name, name_ptr);
- ctx = CTX(sdb_llist_search_by_name(all_plugins, real_name));
+ ctx = CTX(sdb_llist_search_by_name(all_plugins, base_name));
if (ctx) {
/* plugin already loaded */
++ctx->use_cnt;
}
snprintf(filename, sizeof(filename), "%s/%s.so",
- PKGLIBDIR, real_name);
+ PKGLIBDIR, base_name);
filename[sizeof(filename) - 1] = '\0';
if (access(filename, R_OK)) {
if (ctx_get())
sdb_log(SDB_LOG_WARNING, "core: Discarding old plugin context");
- ctx = ctx_create(real_name);
+ ctx = ctx_create(name);
if (! ctx) {
sdb_log(SDB_LOG_ERR, "core: Failed to initialize plugin context");
return -1;