From: Jaroslav Kysela Date: Tue, 13 Oct 2020 14:51:21 +0000 (+0200) Subject: dlsym: use the only alsa plugins directory for the internal modules X-Git-Tag: v1.2.4~10 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=aa89ad93623fc97fed6f99370a97c9c3eee1d6fd;p=alsa-lib.git dlsym: use the only alsa plugins directory for the internal modules 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 --- diff --git a/src/dlmisc.c b/src/dlmisc.c index 0362b9d1..c9517c55 100644 --- a/src/dlmisc.c +++ b/src/dlmisc.c @@ -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; }