summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e6fca77)
raw | patch | inline | side by side (parent: e6fca77)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 27 Apr 2014 10:44:53 +0000 (12:44 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 27 Apr 2014 10:44:53 +0000 (12:44 +0200) |
src/core/plugin.c | patch | blob | history | |
src/include/core/plugin.h | patch | blob | history | |
src/tools/sysdbd/configfile.c | patch | blob | history |
diff --git a/src/core/plugin.c b/src/core/plugin.c
index eb9797fb40f8ba694f687acec082792877d115fd..8cd490a22a7da2f39e946f4d06be445fda1ebba7 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
} /* module_init */
static int
-module_load(const char *name, const sdb_plugin_ctx_t *plugin_ctx)
+module_load(const char *basedir, const char *name,
+ const sdb_plugin_ctx_t *plugin_ctx)
{
char base_name[name ? strlen(name) + 1 : 1];
const char *name_ptr;
}
strcat(base_name, name_ptr);
- snprintf(filename, sizeof(filename), "%s/%s.so",
- PKGLIBDIR, base_name);
+ if (! basedir)
+ basedir = PKGLIBDIR;
+
+ snprintf(filename, sizeof(filename), "%s/%s.so", basedir, base_name);
filename[sizeof(filename) - 1] = '\0';
if (access(filename, R_OK)) {
*/
int
-sdb_plugin_load(const char *name, const sdb_plugin_ctx_t *plugin_ctx)
+sdb_plugin_load(const char *basedir, const char *name,
+ const sdb_plugin_ctx_t *plugin_ctx)
{
ctx_t *ctx;
return 0;
}
- return module_load(name, plugin_ctx);
+ return module_load(basedir, name, plugin_ctx);
} /* sdb_plugin_load */
int
index e5e222fe6c7ca286512e3a7d5c0ba3721ad8a1a6..69c18b41d0ff2cd38d432852d2b1854fee9b8ff8 100644 (file)
* sdb_plugin_load:
* Load (any type of) plugin by loading the shared object file and calling the
* sdb_module_init function. If specified, 'plugin_ctx' fine-tunes the
- * behavior of the plugin.
+ * behavior of the plugin. If specified, the plugin will be looked up in
+ * 'basedir', else it defaults to the package libdir.
*/
int
-sdb_plugin_load(const char *name, const sdb_plugin_ctx_t *plugin_ctx);
+sdb_plugin_load(const char *basedir, const char *name,
+ const sdb_plugin_ctx_t *plugin_ctx);
/*
* sdb_plugin_set_info:
index 25c9404108bef0b61cd0274829bccf539b2762aa..8dc4394f7abfce9450b82a6b01c69f6aa32eb74e 100644 (file)
}
/* returns a negative value on error */
- return sdb_plugin_load(name, NULL);
+ return sdb_plugin_load(NULL, name, NULL);
} /* daemon_load_plugin */
static int
}
}
- return sdb_plugin_load(plugin_name, &ctx);
+ return sdb_plugin_load(NULL, plugin_name, &ctx);
} /* daemon_load_backend */
static int