mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-10 04:27:43 -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,
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ int snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, unsigned int frequenc
|
|||
static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf)
|
||||
{
|
||||
char buf[256];
|
||||
char buf[256], errbuf[256];
|
||||
snd_config_iterator_t i, next;
|
||||
const char *id;
|
||||
const char *lib = NULL, *open_name = NULL, *str = NULL;
|
||||
|
|
@ -670,11 +670,11 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
open_name = buf;
|
||||
snprintf(buf, sizeof(buf), "_snd_pcm_scope_%s_open", str);
|
||||
}
|
||||
h = snd_dlopen(lib, RTLD_NOW);
|
||||
h = snd_dlopen(lib, RTLD_NOW, errbuf, sizeof(errbuf));
|
||||
open_func = h ? dlsym(h, open_name) : NULL;
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue