Commit dbf81108 authored by 's avatar
Browse files

Fixed logging at some systems (64-bit?) (passing va_list to vsnprintf).


git-svn-id: file:///home/svn/mapi/trunk@1353 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 5b9032c7
...@@ -32,11 +32,13 @@ void debug_message(char *fmt, ...){ ...@@ -32,11 +32,13 @@ void debug_message(char *fmt, ...){
char buf[STD_BUF + 1]; char buf[STD_BUF + 1];
va_list ap; va_list ap;
va_list aq;
int len; int len;
buf[STD_BUF] = '\0'; buf[STD_BUF] = '\0';
va_start(ap, fmt); va_start(ap, fmt);
va_copy(aq, ap);
if(log_level == LOG_INFO_DEBUG_ALL || log_level == LOGGING_DISABLED){ // debug messages are printed to stdout and syslog OR logging to if(log_level == LOG_INFO_DEBUG_ALL || log_level == LOGGING_DISABLED){ // debug messages are printed to stdout and syslog OR logging to
// syslog is disabled, thus debug messages are printed only to stdout // syslog is disabled, thus debug messages are printed only to stdout
...@@ -48,7 +50,7 @@ void debug_message(char *fmt, ...){ ...@@ -48,7 +50,7 @@ void debug_message(char *fmt, ...){
if(log_level == LOG_INFO_DEBUG_NOT_STDOUT || log_level == LOG_INFO_DEBUG_ALL){ // print debug messages to syslog if(log_level == LOG_INFO_DEBUG_NOT_STDOUT || log_level == LOG_INFO_DEBUG_ALL){ // print debug messages to syslog
len = vsnprintf(buf, STD_BUF, fmt, ap); len = vsnprintf(buf, STD_BUF, fmt, aq);
sprintf(buf + len, " [%s:%d]", debug_message_file, debug_message_line); // filename and line number information sprintf(buf + len, " [%s:%d]", debug_message_file, debug_message_line); // filename and line number information
buf[STD_BUF] = '\0'; buf[STD_BUF] = '\0';
...@@ -56,6 +58,7 @@ void debug_message(char *fmt, ...){ ...@@ -56,6 +58,7 @@ void debug_message(char *fmt, ...){
if(log_to_syslog) syslog(LOG_LOCAL1 | LOG_DEBUG, "%s", buf); if(log_to_syslog) syslog(LOG_LOCAL1 | LOG_DEBUG, "%s", buf);
} }
va_end(aq);
va_end(ap); va_end(ap);
return; return;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment