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:
Jaroslav Kysela 2017-11-22 13:23:45 +01:00
parent 38a39091e3
commit c051036e17
13 changed files with 90 additions and 51 deletions

View file

@ -76,7 +76,7 @@ static int snd_timer_open_conf(snd_timer_t **timer,
snd_config_t *timer_conf, int mode)
{
const char *str;
char buf[256];
char buf[256], errbuf[256];
int err;
snd_config_t *conf, *type_conf = NULL;
snd_config_iterator_t i, next;
@ -150,12 +150,12 @@ static int snd_timer_open_conf(snd_timer_t **timer,
#ifndef PIC
snd_timer_open_symbols();
#endif
h = snd_dlopen(lib, RTLD_NOW);
h = snd_dlopen(lib, RTLD_NOW, errbuf, sizeof(errbuf));
if (h)
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_DLSYM_VERSION));
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);