]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: Fix the va_list initialization in cerror_() and dbg_()
authorJaroslav Kysela <perex@perex.cz>
Sun, 29 Dec 2013 19:03:21 +0000 (20:03 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 29 Dec 2013 19:06:53 +0000 (20:06 +0100)
The <ap> argument for syslog_() was uninitialized.

From: Alan Hamilton <alanh@arizonaroads.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsactl/utils.c

index 072c23998e4528e343a3b501f05c1140c22f3ccc..b5d183cb437c5b89ef66fd3f2031e3945b3e6d66 100644 (file)
@@ -150,10 +150,10 @@ void cerror_(const char *fcn, long line, int cond, const char *fmt, ...)
 
        if (!cond && !debugflag)
                return;
+       va_start(ap, fmt);
        if (use_syslog) {
                syslog_(LOG_ERR, fcn, line, fmt, ap);
        } else {
-               va_start(ap, fmt);
                fprintf(stderr, "%s: %s:%ld: ", command, fcn, line);
                vfprintf(stderr, fmt, ap);
                putc('\n', stderr);
@@ -167,10 +167,10 @@ void dbg_(const char *fcn, long line, const char *fmt, ...)
 
        if (!debugflag)
                return;
+       va_start(ap, fmt);
        if (use_syslog) {
                syslog_(LOG_DEBUG, fcn, line, fmt, ap);
        } else {
-               va_start(ap, fmt);
                fprintf(stderr, "%s: %s:%ld: ", command, fcn, line);
                vfprintf(stderr, fmt, ap);
                putc('\n', stderr);