]> git.alsa-project.org Git - alsa-lib.git/commitdiff
error: return old snd_lib_error_set_handler() behaviour
authorJaroslav Kysela <perex@perex.cz>
Wed, 7 Jan 2026 16:41:03 +0000 (17:41 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 7 Jan 2026 16:48:39 +0000 (17:48 +0100)
Unfortunately, the case when the old application sets
own error callback using the old method, was not handled
properly in snd_lib_vlog_default() function.

Make sure that only error messages are passed to this
old callback and silent other log priorities.

Link: https://bugs.gentoo.org/968131
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/error.c

index e575f2ebd0e12c180ffd112f58420d4579fb4d9d..1cb8a57923e1964f90c71e191060bd78419a19be 100644 (file)
@@ -34,6 +34,8 @@
 #include <stdarg.h>
 #include <string.h>
 
+static void snd_lib_error_default(const char *file, int line, const char *function, int errcode, const char *fmt, ...);
+
 /**
  * Array of error codes in US ASCII.
  */
@@ -317,6 +319,12 @@ static void snd_lib_vlog_default(int prio, int interface, const char *file, int
                local_error(file, line, function, errcode, fmt, arg);
                return;
        }
+       if (snd_lib_error != snd_lib_error_default) {
+               if (prio == SND_LOG_ERROR)
+                       snd_lib_error(file, line, function, errcode, fmt, arg);
+               /* ignore other priorities - restore old behaviour */
+               return;
+       }
 
        if (!snd_lib_log_filter(prio, interface, NULL))
                return;