]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
need to flush logs before forking when unbuffered_logs = 1
authorwessels <>
Tue, 15 Jul 1997 11:34:08 +0000 (11:34 +0000)
committerwessels <>
Tue, 15 Jul 1997 11:34:08 +0000 (11:34 +0000)
src/dns.cc
src/ftp.cc
src/globals.h
src/icmp.cc
src/main.cc
src/protos.h
src/redirect.cc
src/tools.cc
src/unlinkd.cc
src/useragent.cc

index c9c6677dc906eaf7599651a70b18c42229cbbd04..f028a315df3fa819706fe8237d8d1581abaee5e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dns.cc,v 1.36 1997/07/07 05:29:44 wessels Exp $
+ * $Id: dns.cc,v 1.37 1997/07/15 05:34:08 wessels Exp $
  *
  * DEBUG: section 34    Dnsserver interface
  * AUTHOR: Harvest Derived
@@ -143,6 +143,8 @@ dnsOpenServer(const char *command)
        return -1;
     }
     listen(cfd, 1);
+    /* flush or else we get dup data if unbuffered_logs is set */
+    logsFlush();
     if ((pid = fork()) < 0) {
        debug(50, 0) ("dnsOpenServer: fork: %s\n", xstrerror());
        comm_close(cfd);
index d5cdcead68b5ca8df80cb2543fac77eaa2075480..8d556e1e8779b8603af4a1075f286e7c605ef48b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.131 1997/07/14 23:44:59 wessels Exp $
+ * $Id: ftp.cc,v 1.132 1997/07/15 05:34:09 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -1446,7 +1446,6 @@ ftpAppendSuccessHeader(FtpStateData * ftpState)
     char *t = NULL;
     StoreEntry *e = ftpState->entry;
     http_reply *reply = e->mem_obj->reply;
-    debug(0,0)("ftpAppendSuccessHeader: %s\n", ftpState->entry->url);
     if (EBIT_TEST(ftpState->flags, FTP_HTTP_HEADER_SENT))
        return;
     EBIT_SET(ftpState->flags, FTP_HTTP_HEADER_SENT);
index 618aec78e41aefa5b8477df663689de448ea8591..5ca29f8efa0ace019a7b839792b442bd28c619da 100644 (file)
@@ -1,5 +1,6 @@
 
-extern FILE *debug_log;
+extern FILE *debug_log; /* NULL */
+extern FILE *cache_useragent_log; /* NULL */
 extern Meta_data meta_data;
 extern SquidConfig Config;
 extern SquidConfig2 Config2;
@@ -89,3 +90,4 @@ extern int fileno_stack_count; /* 0 */
 #ifdef HAVE_SYSLOG
 extern int _db_level;
 #endif
+
index 1ee2b7d2b758add07acd7b0b92cb5367f040896e..6d9c14c85bd64b6dd186a1cf0db794c38f1c899c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icmp.cc,v 1.39 1997/07/14 03:33:38 wessels Exp $
+ * $Id: icmp.cc,v 1.40 1997/07/15 05:34:10 wessels Exp $
  *
  * DEBUG: section 37    ICMP Routines
  * AUTHOR: Duane Wessels
@@ -266,6 +266,8 @@ icmpOpen(void)
     getsockname(child_sock, (struct sockaddr *) &S, &namelen);
     if (comm_connect_addr(icmp_sock, &S) != COMM_OK)
        fatal_dump(xstrerror());
+    /* flush or else we get dup data if unbuffered_logs is set */
+    logsFlush();
     if ((pid = fork()) < 0) {
        debug(50, 0) ("icmpOpen: fork: %s\n", xstrerror());
        comm_close(icmp_sock);
index 6d222d46c933afa583e28df36ebe8ac4939d84cb..99242184a71933cd051d278efb4793cadc578343 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.cc,v 1.161 1997/07/14 23:45:02 wessels Exp $
+ * $Id: main.cc,v 1.162 1997/07/15 05:34:11 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -482,6 +482,7 @@ mainInitialize(void)
     debug(1, 0) ("Starting Squid Cache version %s for %s...\n",
        version_string,
        CONFIG_HOST_TYPE);
+    debug(1, 0) ("Process ID %d\n", (int) getpid());
     debug(1, 1) ("With %d file descriptors available\n", Squid_MaxFD);
 
     if (!configured_once) {
index b20e2627a110d8ddf2bba2aeb8237a77e159ae1f..196fc080cc737100b776b00156286fd365e3198d 100644 (file)
@@ -560,6 +560,7 @@ extern struct in_addr inaddrFromHostent _PARAMS((const struct hostent * hp));
 extern int intAverage _PARAMS((int, int, int, int));
 extern double doubleAverage _PARAMS((double, double, int, int));
 extern void debug_trap _PARAMS((const char *));
+extern void logsFlush _PARAMS((void));
 
 
 extern void unlinkdInit _PARAMS((void));
index 25fd2a9d03dfff6d4b6decb0ceeece15eabf443a..09b97dc753cb801097fbf389c92d57ad157f9003 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: redirect.cc,v 1.44 1997/06/04 06:16:07 wessels Exp $
+ * $Id: redirect.cc,v 1.45 1997/07/15 05:34:12 wessels Exp $
  *
  * DEBUG: section 29    Redirector
  * AUTHOR: Duane Wessels
@@ -113,6 +113,8 @@ redirectCreateRedirector(const char *command)
        return -1;
     }
     listen(cfd, 1);
+    /* flush or else we get dup data if unbuffered_logs is set */
+    logsFlush();
     if ((pid = fork()) < 0) {
        debug(50, 0) ("redirect_create_redirector: fork: %s\n", xstrerror());
        comm_close(cfd);
index e3b06ad8d2f63a30759fb5c04d7be4ab1f5f30c5..9cbe14fcf5ab0d345b617382b7fca7cdeaf989fc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.114 1997/07/14 23:45:07 wessels Exp $
+ * $Id: tools.cc,v 1.115 1997/07/15 05:34:13 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -750,3 +750,12 @@ intAverage(int cur, int new, int n, int max)
        n = max;
     return (cur * (n - 1)) + new / n;
 }
+
+void
+logsFlush(void)
+{
+    if (debug_log)
+       fflush(debug_log);
+    if (cache_useragent_log)
+       fflush(cache_useragent_log);
+}
index 8938d3355710d95838b94a87909cec68b59d89c3..9cf268c8a47ff1ca11bb688f48a0f4604897ab09 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: unlinkd.cc,v 1.7 1997/07/07 05:29:58 wessels Exp $
+ * $Id: unlinkd.cc,v 1.8 1997/07/15 05:34:14 wessels Exp $
  *
  * DEBUG: section 43    Unlink Daemon
  * AUTHOR: Duane Wessels
@@ -102,6 +102,8 @@ unlinkdCreate(void)
     wfd1 = squid_to_unlinkd[1];
     rfd2 = unlinkd_to_squid[0];
     wfd2 = unlinkd_to_squid[1];
+    /* flush or else we get dup data if unbuffered_logs is set */
+    logsFlush();
     if ((pid = fork()) < 0) {
        debug(50, 0) ("unlinkdCreate: fork: %s\n", xstrerror());
        close(rfd1);
index fc4cbcc077351585b2f686c3e024c02c33de64a2..cf15aa92671d9cb7d93fa87fe97e8de68f93d90a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: useragent.cc,v 1.7 1997/06/04 06:16:16 wessels Exp $
+ * $Id: useragent.cc,v 1.8 1997/07/15 05:34:14 wessels Exp $
  *
  * DEBUG: section 40    User-Agent logging
  * AUTHOR: Joe Ramey <ramey@csc.ti.com>
@@ -31,8 +31,6 @@
 
 #include "squid.h"
 
-FILE *cache_useragent_log = NULL;
-
 void
 useragentOpenLog(void)
 {