From 3e35983f95fd46cc8c22337b514cc4c9e55e563c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Jan 2008 17:17:58 +0100 Subject: [PATCH] Avoid (null) in printf Show '[builtin]' when the library name is NULL in error messages. --- src/pcm/pcm.c | 6 ++++-- src/pcm/pcm_hooks.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 100cafd1..2ab4e75e 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -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; } diff --git a/src/pcm/pcm_hooks.c b/src/pcm/pcm_hooks.c index edfed72a..0b456aba 100644 --- a/src/pcm/pcm_hooks.c +++ b/src/pcm/pcm_hooks.c @@ -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; } -- 2.47.1