]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bugzilla #177: LinuxPPC 2000 segfault bug
authorwessels <>
Sat, 30 Jun 2001 03:16:42 +0000 (03:16 +0000)
committerwessels <>
Sat, 30 Jun 2001 03:16:42 +0000 (03:16 +0000)
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.

src/debug.cc

index 379d91e61c32040bda2d31f0809ae9db630c16e7..323d61254939ad24cb6a970915cf08858e7bbe68 100644 (file)
@@ -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