Re: [Squid-cvs] cygwin squid/src useragent.c,1.3.28.2,1.3.28.3

From: Guido Serassio <serassio@dont-contact.us>
Date: Sun, 15 Jul 2001 18:08:15 +0200

Hi,

Il 00.04 12/07/2001 Duane Wessels ha scritto:

>
> > >And I think the check should be in logfileClose, not in each function
> > >using it..
> >
> > This is a better solution, in logfileClose seems to be no protection
> from this.
>
>It should be in each function using it. That is the way it is
>currently done.
>
>All of the logfile functions assume that their arguments are valid.
>It is up to the caller to check for NULL pointers and such.

OK,

In useragent.c we have a potential problem:

If Squid is compiled with useragent log enabled, but this is not configured
in squid.conf,
useragentlog is NULL, so we have a segmentation fault at Squid shutdown time.

>I want logfileClose(NULL) to be an error, just as fclose(NULL)
>is an error.

So, if this must be true, the only logical solution is to add the following
check to the HEAD and 2.4S1 code:

Index: useragent.c
===================================================================
RCS file: /cvsroot/squid/squid/src/useragent.c,v
retrieving revision 1.3.28.2
retrieving revision 1.3.28.3
diff -w -u -r1.3.28.2 -r1.3.28.3
--- useragent.c 2001/05/21 21:10:28 1.3.28.2
+++ useragent.c 2001/07/10 20:25:43 1.3.28.3
@@ -87,6 +87,7 @@
useragentLogClose(void)
{
#if USE_USERAGENT_LOG
+ if (NULL != useragentlog)
      logfileClose(useragentlog);
      useragentlog = NULL;
#endif

Guido

-
=======================================================
Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
Tel. : +39.011.610749
E-mail: serassio@interfree.it
         serassio@libero.it
WWW: http://www.serassio.it
Received on Sun Jul 15 2001 - 10:08:27 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:07 MST