]> git.alsa-project.org Git - alsa-lib.git/commitdiff
dlsym: use the only alsa plugins directory for the internal modules
authorJaroslav Kysela <perex@perex.cz>
Tue, 13 Oct 2020 14:51:21 +0000 (16:51 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 13 Oct 2020 15:00:29 +0000 (17:00 +0200)
The commit b2a4272ecb40d84556d8e043d0b6e89439acbc33 introduced a slightly
different behaviour for ALSA_PLUGIN_DIR. The fallback causes that the
alsa libraries are searched in all library directories.

It was never intended to do the system wide library lookups for
internal modules.

Fixes: b2a4272ecb40 ("snd_dlopen: do not use absolute plugin path for snd_dlopen() calls")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/dlmisc.c

index 0362b9d1cc682e279b6c2a4ab3585e5d53c77ba5..c9517c5519a1a9aa87b04ce1872e55bbd011e784 100644 (file)
@@ -147,31 +147,20 @@ void *snd_dlopen(const char *name, int mode, char *errbuf, size_t errbuflen)
         * via ld.so.conf.
         */
        void *handle = NULL;
-       const char *filename = NULL;
+       const char *filename = name;
        char path[PATH_MAX];
 
        if (name && name[0] != '/') {
-               if (snd_dlpath(path, sizeof(path), name) == 0) {
+               if (snd_dlpath(path, sizeof(path), name) == 0)
                        filename = path;
-                       handle = dlopen(filename, mode);
-                       if (!handle) {
-                               /* if the filename exists and cannot be opened */
-                               /* return immediately */
-                               if (access(filename, X_OK) == 0)
-                                       goto errpath;
-                       }
-               }
-       }
-       if (!handle) {
-               filename = name;
-               handle = dlopen(name, mode);
-               if (!handle)
-                       goto errpath;
        }
+       handle = dlopen(filename, mode);
+       if (!handle)
+               goto errpath;
        return handle;
 errpath:
        if (errbuf)
-               snprintf(errbuf, errbuflen, "%s: %s", filename, dlerror());
+               snprintf(errbuf, errbuflen, "%s", dlerror());
 #endif
        return NULL;
 }