mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-12 13:30:12 -05:00
Change snd_dlopen() function to return the error string
The dlopen() function might fail also for another reason than a missing file, thus return the error string from dlerror(). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
38a39091e3
commit
c051036e17
13 changed files with 90 additions and 51 deletions
|
|
@ -341,7 +341,7 @@ even if the specified control doesn't exist.
|
|||
static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_t *conf)
|
||||
{
|
||||
int err;
|
||||
char buf[256];
|
||||
char buf[256], errbuf[256];
|
||||
const char *str, *id;
|
||||
const char *lib = NULL, *install = NULL;
|
||||
snd_config_t *type = NULL, *args = NULL;
|
||||
|
|
@ -424,12 +424,12 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
install = buf;
|
||||
snprintf(buf, sizeof(buf), "_snd_pcm_hook_%s_install", str);
|
||||
}
|
||||
h = snd_dlopen(lib, RTLD_NOW);
|
||||
h = snd_dlopen(lib, RTLD_NOW, errbuf, sizeof(errbuf));
|
||||
install_func = h ? snd_dlsym(h, install, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION)) : NULL;
|
||||
err = 0;
|
||||
if (!h) {
|
||||
SNDERR("Cannot open shared library %s",
|
||||
lib ? lib : "[builtin]");
|
||||
SNDERR("Cannot open shared library %s (%s)",
|
||||
lib ? lib : "[builtin]", errbuf);
|
||||
err = -ENOENT;
|
||||
} else if (!install_func) {
|
||||
SNDERR("symbol %s is not defined inside %s", install,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue