closing of log files

From: Radu Greab <radu@dont-contact.us>
Date: Wed, 30 May 2001 18:46:14 +0300

The patch below against SQUID_2_4 adds the code needed to close the
referer log. It also adds sanity checks in a few locations to prevent
core dumps. The sanity check added to useragentLogClose() fixes the
bug id 158.

I also found that the path for headerslog, enabled if HEADERS_LOG is
defined, is hard-coded in access_log.c to
"/usr/local/squid/logs/headers.log". Should a proper configuration
variable be added to correct this inflexibility?

Thank you,
Radu Greab

Index: src/forward.c
===================================================================
RCS file: /squid/squid/src/forward.c,v
retrieving revision 1.75.2.1
diff -u -r1.75.2.1 forward.c
--- src/forward.c 2001/01/12 00:51:47 1.75.2.1
+++ src/forward.c 2001/05/30 15:30:01
@@ -703,6 +703,8 @@
 void
 fwdUninit(void)
 {
+ if (NULL == logfile)
+ return;
     logfileClose(logfile);
     logfile = NULL;
 }
Index: src/main.c
===================================================================
RCS file: /squid/squid/src/main.c,v
retrieving revision 1.322.2.5
diff -u -r1.322.2.5 main.c
--- src/main.c 2001/05/20 00:09:59 1.322.2.5
+++ src/main.c 2001/05/30 15:30:02
@@ -956,6 +956,7 @@
     storeLogClose();
     accessLogClose();
     useragentLogClose();
+ refererLogClose();
 #if WIP_FWD_LOG
     fwdUninit();
 #endif
Index: src/protos.h
===================================================================
RCS file: /squid/squid/src/protos.h,v
retrieving revision 1.387.2.6
diff -u -r1.387.2.6 protos.h
--- src/protos.h 2001/05/20 00:09:59 1.387.2.6
+++ src/protos.h 2001/05/30 15:30:04
@@ -1054,6 +1054,7 @@
 extern void refererOpenLog(void);
 extern void refererRotateLog(void);
 extern void logReferer(const char *, const char *, const char *);
+extern void refererLogClose(void);
 extern peer_t parseNeighborType(const char *s);
 
 extern void errorInitialize(void);
Index: src/referer.c
===================================================================
RCS file: /squid/squid/src/referer.c,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 referer.c
--- src/referer.c 2001/05/22 20:32:35 1.2.2.2
+++ src/referer.c 2001/05/30 15:30:04
@@ -77,3 +77,14 @@
         uri ? uri : "-");
 #endif
 }
+
+void
+refererLogClose(void)
+{
+#if USE_REFERER_LOG
+ if (NULL == refererlog)
+ return;
+ logfileClose(refererlog);
+ refererlog = NULL;
+#endif
+}
Index: src/useragent.c
===================================================================
RCS file: /squid/squid/src/useragent.c,v
retrieving revision 1.22.2.3
diff -u -r1.22.2.3 useragent.c
--- src/useragent.c 2001/05/20 00:09:59 1.22.2.3
+++ src/useragent.c 2001/05/30 15:30:04
@@ -87,6 +87,8 @@
 useragentLogClose(void)
 {
 #if USE_USERAGENT_LOG
+ if (NULL == useragentlog)
+ return;
     logfileClose(useragentlog);
     useragentlog = NULL;
 #endif
Received on Wed May 30 2001 - 09:46:25 MDT

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