]> git.alsa-project.org Git - alsa-lib.git/commitdiff
snd_dlopen: do not use absolute plugin path for snd_dlopen() calls
authorJaroslav Kysela <perex@perex.cz>
Thu, 4 Jun 2020 16:22:59 +0000 (18:22 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 4 Jun 2020 17:09:50 +0000 (19:09 +0200)
In commit b906db19ef9f4fb7886003072e550391cc1ac651, the snd_dlopen()
implements the automatic lookup to the ALSA_PLUGIN_DIR directory.
It is not necessary to add the absolute paths in callers now.

The plugin names are also searched in ld.so.conf paths as the fallback now,
but it should not be a big problem.

BugLink: https://github.com/alsa-project/alsa-lib/issues/34
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
modules/mixer/simple/sbasedl.c
src/control/control.c
src/mixer/simple_abst.c
src/pcm/pcm.c
src/pcm/pcm_rate.c

index d8cbf0f10ee00701f208f625992bcd3b3d48e0c7..a1b33ccc4865b05faf511d2759ff57ada34eace1 100644 (file)
@@ -33,7 +33,7 @@
 #include "mixer_abst.h"
 #include "sbase.h"
 
-#define SO_PATH ALSA_PLUGIN_DIR "/smixer"
+#define SO_PATH "smixer"
 
 int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
                              bclass_base_ops_t **ops)
index 27f421350fb7991f9bd653c9e6e441febedf237e..19528ae30a0bec32eabe07adda8c7f342b89c12b 100644 (file)
@@ -1337,13 +1337,13 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
                        build_in++;
                }
                if (*build_in == NULL) {
-                       buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
+                       buf1 = malloc(strlen(str) + 32);
                        if (buf1 == NULL) {
                                err = -ENOMEM;
                                goto _err;
                        }
                        lib = buf1;
-                       sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str);
+                       sprintf(buf1, "libasound_module_ctl_%s.so", str);
                }
        }
 #ifndef PIC
index 9c61cb58f3b207d112e08065c355d9ef0ef229e0..4dcc4cc7e35ae4ff8dd0b5972dc12506ab6391d1 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef DOC_HIDDEN
 
-#define SO_PATH ALSA_PLUGIN_DIR "/smixer"
+#define SO_PATH "smixer"
 
 typedef struct _class_priv {
        char *device;
index 261e80ac6110e951f083cd22a15cecf02f959e3b..98b5ced4dceaa963fe0973902d1a3d30944e24f5 100644 (file)
@@ -2578,13 +2578,13 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
                        build_in++;
                }
                if (*build_in == NULL) {
-                       buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
+                       buf1 = malloc(strlen(str) + 32);
                        if (buf1 == NULL) {
                                err = -ENOMEM;
                                goto _err;
                        }
                        lib = buf1;
-                       sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str);
+                       sprintf(buf1, "libasound_module_pcm_%s.so", str);
                }
        }
 #ifndef PIC
index 9ec8c85ef13fcdb8e6e607a864a6e79039c0cd5a..5bf7dbb94a613e0ce21d743b5f2c64908e1a7783 100644 (file)
@@ -1281,7 +1281,7 @@ static const char *const default_rate_plugins[] = {
 
 static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose)
 {
-       char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL;
+       char open_name[64], open_conf_name[64], lib_name[64], *lib = NULL;
        snd_pcm_rate_open_func_t open_func;
        snd_pcm_rate_open_conf_func_t open_conf_func;
        int err;
@@ -1290,7 +1290,7 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf
        snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type);
        if (!is_builtin_plugin(type)) {
                snprintf(lib_name, sizeof(lib_name),
-                                "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type);
+                                "libasound_module_rate_%s.so", type);
                lib = lib_name;
        }