This patch gets things working again for me on Linux.
diff -ubr polipo-1.0.4/log.c polipo-new/log.c
--- polipo-1.0.4/log.c 2008-01-08 04:56:45.000000000 -0800
+++ polipo-new/log.c 2009-04-22 19:26:38.000000000 -0700
@@ -279,11 +279,14 @@
accumulateSyslogV(int type, const char *f, va_list args)
{
int rc;
+ va_list args_copy;
again:
+ va_copy(args_copy, args);
rc = vsnprintf(syslogBuf + syslogBufLength,
syslogBufSize - syslogBufLength,
- f, args);
+ f, args_copy);
+ va_end(args);
if(rc < 0 || rc >= syslogBufSize - syslogBufLength) {
rc = expandSyslog(rc);
@@ -372,7 +375,12 @@
{
if(type & LOGGING_MAX & logLevel) {
if(logF)
- vfprintf(logF, f, args);
+ {
+ va_list args_copy;
+ va_copy(args_copy, args);
+ vfprintf(logF, f, args_copy);
+ va_end(args_copy);
+ }
#ifdef HAVE_SYSLOG
if(logSyslog)
accumulateSyslogV(type, f, args);
@@ -399,8 +407,11 @@
es = "Unknown error";
if(logF) {
- vfprintf(logF, f, args);
+ va_list args_copy;
+ va_copy(args_copy, args);
+ vfprintf(logF, f, args_copy);
fprintf(logF, ": %s\n", es);
+ va_end(args_copy);
}
#ifdef HAVE_SYSLOG
if(logSyslog) {
diff -ubr polipo-1.0.4/util.c polipo-new/util.c
--- polipo-1.0.4/util.c 2008-01-08 04:56:45.000000000 -0800
+++ polipo-new/util.c 2009-04-22 19:30:04.000000000 -0700
@@ -281,8 +281,11 @@
int n, size;
char buf[64];
char *string;
+ va_list args_copy;
- n = vsnprintf(buf, 64, f, args);
+ va_copy(args_copy, args);
+ n = vsnprintf(buf, 64, f, args_copy);
+ va_end(args_copy);
if(n >= 0 && n < 64) {
return strdup_n(buf, n);
}
@@ -295,7 +298,9 @@
string = malloc(size);
if(!string)
return NULL;
- n = vsnprintf(string, size, f, args);
+ va_copy(args_copy, args);
+ n = vsnprintf(string, size, f, args_copy);
+ va_end(args_copy);
if(n >= 0 && n < size)
return string;
else if(n >= size)
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users