Avoid (null) in printf

Show '[builtin]' when the library name is NULL in error messages.
This commit is contained in:
Takashi Iwai 2008-01-09 17:17:58 +01:00
parent 328824509f
commit 3e35983f95
2 changed files with 8 additions and 4 deletions

View file

@ -2100,10 +2100,12 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION));
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
SNDERR("Cannot open shared library %s",
lib ? lib : "[builtin]");
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
SNDERR("symbol %s is not defined inside %s", open_name,
lib ? lib : "[builtin]");
snd_dlclose(h);
err = -ENXIO;
}

View file

@ -388,10 +388,12 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
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);
SNDERR("Cannot open shared library %s",
lib ? lib : "[builtin]");
err = -ENOENT;
} else if (!install_func) {
SNDERR("symbol %s is not defined inside %s", install, lib);
SNDERR("symbol %s is not defined inside %s", install,
lib ? lib : "[builtin]");
snd_dlclose(h);
err = -ENXIO;
}