dlsym: use the only alsa plugins directory for the internal modules

The commit b2a4272ecb 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: b2a4272ecb ("snd_dlopen: do not use absolute plugin path for snd_dlopen() calls")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-10-13 16:51:21 +02:00
parent 2a204a5412
commit aa89ad9362

View 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;
}