From: Jaroslav Kysela Date: Tue, 20 Oct 2020 16:45:11 +0000 (+0200) Subject: handle TINYCOMPRESS_PLUGIN_DIR environment variable X-Git-Tag: v1.2.4~2 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=435a2a09d33b93dc6f72a332a1b44f86527e8836;p=tinycompress.git handle TINYCOMPRESS_PLUGIN_DIR environment variable 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 --- diff --git a/src/lib/compress.c b/src/lib/compress.c index f273744..68f1b55 100644 --- a/src/lib/compress.c +++ b/src/lib/compress.c @@ -117,11 +117,16 @@ static int populate_compress_plugin_ops(struct compress *compress, const char *n 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);