Hello. I have a patch to fix a problem with wget segfaulting on the
powerpc platform. It happens in the logvprintf routine, due to differences
in the handling of va_lists on ppc vs. x86. The problem was that it was
reusing a va_list after it had already been exhausted, and the following
fix should be portable on at least any platform using gcc.
I'm afraid the the patch may be malformed wrt whitespace, but it is small
enough that you shouldn't have a problem applying it by hand.
--- wget-1.7.old/src/log.c Sun May 27 12:35:05 2001
+++ wget-1.7/src/log.c Fri Sep 28 09:29:48 2001
@@ -280,9 +280,12 @@
static void
logvprintf (enum log_options o, const char *fmt, va_list args)
{
+ va_list all_the_args;
+
CHECK_VERBOSE (o);
CANONICALIZE_LOGFP_OR_RETURN;
+ __va_copy(all_the_args,args);
/* Originally, we first used vfprintf(), and then checked whether
the message needs to be stored with vsprintf(). However, Watcom
C didn't like ARGS being used twice, so now we first vsprintf()
@@ -310,7 +313,9 @@
the systems where vsnprintf() is not available, we use
the implementation from snprintf.c which does return the
correct value. */
- int numwritten =3D vsnprintf (write_ptr, available_size, fmt, args);
+ int numwritten;
+ __va_copy(args,all_the_args);
+ numwritten =3D vsnprintf (write_ptr, available_size, fmt, args);
/* vsnprintf() will not step over the limit given by
available_size. If it fails, it will return either -1
--
David Roundy
http://civet.berkeley.edu/droundy/
msg01993/pgp0.pgp
Description: PGP signature