From: wessels <> Date: Sat, 30 Jun 2001 03:16:42 +0000 (+0000) Subject: Bugzilla #177: LinuxPPC 2000 segfault bug X-Git-Tag: SQUID_3_0_PRE1~1475 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cd11dce665286da3742317b009c7f21637a643a7;p=thirdparty%2Fsquid.git Bugzilla #177: LinuxPPC 2000 segfault bug The previous patch wasn't sufficient to fix this bug. We have to call va_start() for each time the args will be used in some "v" (vprintf, etc) function later on. This patch has been tested on Joe's powerpc-unknown-linux-gnu system. --- diff --git a/src/debug.cc b/src/debug.cc index 379d91e61c..323d612549 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,6 +1,6 @@ /* - * $Id: debug.cc,v 1.82 2001/06/26 21:07:09 wessels Exp $ + * $Id: debug.cc,v 1.83 2001/06/29 21:16:42 wessels Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -49,29 +49,38 @@ void #if STDC_HEADERS _db_print(const char *format,...) { - va_list args; #else _db_print(va_alist) va_dcl { - va_list args; const char *format = NULL; #endif LOCAL_ARRAY(char, f, BUFSIZ); + va_list args1; #if STDC_HEADERS - va_start(args, format); + va_list args2; + va_list args3; + va_start(args1, format); + va_start(args2, format); + va_start(args3, format); #else - format = va_arg(args, const char *); +#define args2 args1 +#define args3 args1 + format = va_arg(args1, const char *); #endif snprintf(f, BUFSIZ, "%s| %s", debugLogTime(squid_curtime), format); - _db_print_file(f, args); - _db_print_stderr(f, args); + _db_print_file(f, args1); + _db_print_stderr(f, args2); #if HAVE_SYSLOG - _db_print_syslog(format, args); + _db_print_syslog(format, args3); +#endif + va_end(args1); +#if STDC_HEADERS + va_end(args2); + va_end(args3); #endif - va_end(args); } static void