From 460aa6f089fcdb34d78af1c8391cbecbcc6b0db3 Mon Sep 17 00:00:00 2001 From: Patrick Marchand Latifi Date: Sat, 23 Feb 2008 21:03:21 -0800 Subject: [PATCH] fix reuse of va_list in debugging mode Make sure we reinitialize the va_list since va_list is undefined if a function traverses the va_list with va_arg. This patch fixes the debugging case when both stdout and syslog output is wanted. Signed-off-by: Patrick Marchand Latifi --- dapl/common/dapl_debug.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dapl/common/dapl_debug.c b/dapl/common/dapl_debug.c index f0959c2..9f4fa04 100644 --- a/dapl/common/dapl_debug.c +++ b/dapl/common/dapl_debug.c @@ -42,18 +42,19 @@ void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...) if ( type & g_dapl_dbg_type ) { - va_start (args, fmt); - if ( DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest ) { + va_start (args, fmt); dapl_os_vprintf (fmt, args); + va_end (args); } if ( DAPL_DBG_DEST_SYSLOG & g_dapl_dbg_dest ) { + va_start (args, fmt); dapl_os_syslog(fmt, args); + va_end (args); } - va_end (args); } } -- 2.46.0