Re: Crash after retrieving digg.com

Nix <[email protected]>
Newsgroups gmane.comp.web.polipo.user
Message-ID <[email protected]>
On 27 Apr 2009, Juliusz Chroboczek said:

> Nix, could you please review this patch?
>
>     http://mid.gmane.org/[email protected]
>
> (I still wish I hadn't agreed to merge the syslog code -- we keep hitting
> bugs in it, and since I don't use syslog, I don't test it myself.)

Another bug? Oh blast, I had higher opinions of my code quality than
this :(

... oh, va_args. Hate. Worst misfeature in C bar declaration syntax and
arrays. Plus it's really hard to see a misuse on many platforms,
including every one I had access to when I tested this...


We probably want to clone the crude three-line va_copy() fallback
implementation in util.c into log.c as well (although I'm skeptical if
platforms exist that have vsnprintf() but not va_copy()).

One tiny typo:

> 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);

... you mean va_end (args_copy); here.

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.