[ofa-general] [PATCH] [DAPL v2] uDAT: fix reuse of va_list in debugging mode

Patrick Marchand Latifi patrick.latifi at qlogic.com
Fri Mar 7 09:39:22 PST 2008


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 uDAT debugging case when both stdout and
syslog output is wanted.

Signed-off-by: Patrick Marchand Latifi <patrick.latifi at qlogic.com>
---

 dat/udat/linux/dat_osd.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dat/udat/linux/dat_osd.c b/dat/udat/linux/dat_osd.c
index e49c489..bc66828 100644
--- a/dat/udat/linux/dat_osd.c
+++ b/dat/udat/linux/dat_osd.c
@@ -116,20 +116,20 @@ dat_os_dbg_print (
     {
 	va_list args;
 
-	va_start (args, fmt);
-
 	if ( DAT_OS_DBG_DEST_STDOUT & g_dbg_dest )
 	{
+	    va_start (args, fmt);
 	    vfprintf (stdout, fmt, args);
 	    fflush (stdout);
+	    va_end (args);
 	}
 
 	if ( DAT_OS_DBG_DEST_SYSLOG & g_dbg_dest )
 	{
+	    va_start (args, fmt);
 	    vsyslog (LOG_USER | LOG_DEBUG, fmt, args);
+	    va_end (args);
 	}
-
-	va_end (args);
     }
 }
 




More information about the general mailing list