The path specified in environment variable TINYCOMPRESS_PLUGIN_DIR
can be used to modify the build-in path at runtime.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
char lib_name[128];
void *dl_hdl;
const char *err = NULL;
+ const char *s;
token = strdup(name);
compr_name = strtok_r(token, ":", &token_saveptr);
- snprintf(lib_name, sizeof(lib_name), "%slibtinycompress_module_%s.so", TINYCOMPRESS_PLUGIN_DIR, compr_name);
+ s = getenv("TINYCOMPRESS_PLUGIN_DIR");
+ if (s == NULL)
+ s = TINYCOMPRESS_PLUGIN_DIR;
+
+ snprintf(lib_name, sizeof(lib_name), "%slibtinycompress_module_%s.so", s, compr_name);
free(token);
dl_hdl = dlopen(lib_name, RTLD_NOW);