X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=errlog.c;h=9b9fd5005b9ac059206bf8b80af0027c304155b3;hb=0072b2fd5d165c25c258a69481b9a738bac9d801;hp=99ec173b97db51b0f02d0543fcc5f7a1510f167f;hpb=012d42b2bc1d16da6f56fc4e143f6cacc34df202;p=privoxy.git diff --git a/errlog.c b/errlog.c index 99ec173b..9b9fd500 100644 --- a/errlog.c +++ b/errlog.c @@ -1,4 +1,4 @@ -const char errlog_rcs[] = "$Id: errlog.c,v 1.47 2006/11/28 15:25:15 fabiankeil Exp $"; +const char errlog_rcs[] = "$Id: errlog.c,v 1.49 2007/04/08 16:44:15 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/errlog.c,v $ @@ -33,6 +33,14 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.47 2006/11/28 15:25:15 fabiankeil E * * Revisions : * $Log: errlog.c,v $ + * Revision 1.49 2007/04/08 16:44:15 fabiankeil + * We need for gettimeofday(), not . + * + * Revision 1.48 2007/03/31 13:33:28 fabiankeil + * Add alternative log_error() with timestamps + * that contain milliseconds and without using + * strcpy(), strcat() or sprintf(). + * * Revision 1.47 2006/11/28 15:25:15 fabiankeil * Only unlink the pidfile if it's actually used. * @@ -273,7 +281,8 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.47 2006/11/28 15:25:15 fabiankeil E #if defined(HAVE_STRLCPY) && defined(HAVE_GETTIMEOFDAY) #define USE_NEW_LOG_ERROR -#include +/* For gettimeofday() */ +#include #endif /* defined(HAVE_STRLCPY) && defined(HAVE_GETTIMEOFDAY) */ #if !defined(_WIN32) && !defined(__OS2__) @@ -797,8 +806,8 @@ void log_error(int loglevel, const char *fmt, ...) outbuf = outbuf_save; /* - * Memsetting the whole buffer to zero - * here make things easier later on. + * Memsetting the whole buffer to zero (in theory) + * makes things easier later on. */ memset(outbuf, 0, log_buffer_size); @@ -827,10 +836,15 @@ void log_error(int loglevel, const char *fmt, ...) if (ch != '%') { outbuf[length++] = ch; - assert(outbuf[length] == '\0'); + /* + * XXX: Only necessary on platforms which don't use pthread + * mutexes (mingw32 for example), where multiple threads can + * write to the buffer at the same time. + */ + outbuf[length] = '\0'; continue; } - assert(outbuf[length] == '\0'); + outbuf[length] = '\0'; ch = *src++; switch (ch) { case '%':