From 8bea4b13d162386e5dbd28371a4491426672a7df Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 8 Jan 2026 13:19:34 +0100 Subject: [PATCH] error: fix the "return old snd_lib_error_set_handler() behaviour" The variable arguments must be handled differently. Add a conversion routine which use the original argument call convention. Fixes: f55eece8 ("error: return old snd_lib_error_set_handler() behaviour") Signed-off-by: Jaroslav Kysela --- src/error.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/error.c b/src/error.c index ae54b598..df8ba522 100644 --- a/src/error.c +++ b/src/error.c @@ -293,6 +293,8 @@ int snd_lib_log_filter(int prio, int interface, const char *configstr) return prio <= (int)level; } +static void snd_lib_error_vdefault(const char *file, int line, const char *function, int errcode, const char *fmt, va_list arg); + /** * \brief The default log handler function. * \param prio Priority value (SND_LOG_*). @@ -322,7 +324,7 @@ static void snd_lib_vlog_default(int prio, int interface, const char *file, int } if (snd_lib_error != snd_lib_error_default) { if (prio == SND_LOG_ERROR) - snd_lib_error(file, line, function, errcode, fmt, arg); + snd_lib_error_vdefault(file, line, function, errcode, fmt, arg); /* ignore other priorities - restore old behaviour */ return; } @@ -452,6 +454,25 @@ static void snd_lib_error_default(const char *file, int line, const char *functi va_end(arg); } +/** + * \brief The default error handler function. + * \param file The filename where the error was hit. + * \param line The line number. + * \param function The function name. + * \param errcode The error code. + * \param fmt The message (including the format characters). + * \param arg Optional arguments. + * \deprecated Since 1.2.15 + * + * Use snd_lib_vlog handler to print error message for anonymous interface. + */ +static void snd_lib_error_vdefault(const char *file, int line, const char *function, int errcode, const char *fmt, va_list arg) +{ + char msg[512]; + vsnprintf(msg, sizeof(msg), fmt, arg); + snd_lib_error(file, line, function, errcode, "%s", msg); +} + /** * \ingroup Error * \deprecated Since 1.2.15 -- 2.47.3