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

@ -41,7 +41,7 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
const char *lib = "smixer-sbase.so";
void (*initpriv)(snd_mixer_class_t *class, struct bclass_private *priv);
char *xlib, *path;
char *xlib, *path, errbuf[256];
void *h;
int initflag = 0;
@ -63,9 +63,9 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
strcpy(xlib, path);
strcat(xlib, "/");
strcat(xlib, lib);
h = snd_dlopen(xlib, RTLD_NOW);
h = snd_dlopen(xlib, RTLD_NOW, errbuf, sizeof(errbuf));
if (h == NULL) {
SNDERR("Unable to open library '%s'", xlib);
SNDERR("Unable to open library '%s': %s", xlib, errbuf);
goto __error;
}
initpriv = dlsym(h, "alsa_mixer_sbasic_initpriv");