]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
close files before renaming for lame microsoft-ish operating systems.
authorwessels <>
Sat, 30 Jan 1999 01:31:17 +0000 (01:31 +0000)
committerwessels <>
Sat, 30 Jan 1999 01:31:17 +0000 (01:31 +0000)
src/access_log.cc
src/useragent.cc

index 2fbef20b1509467e132fb30916b02848e9adbf75..334d571dec9d106c407e8c6b6ad031185e5fde51 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: access_log.cc,v 1.48 1999/01/15 06:36:35 wessels Exp $
+ * $Id: access_log.cc,v 1.49 1999/01/29 18:31:17 wessels Exp $
  *
  * DEBUG: section 46    Access Log
  * AUTHOR: Duane Wessels
@@ -317,13 +317,12 @@ accessLogRotate(void)
        rename(from, to);
     }
     /* Rotate the current log to .0 */
+    file_close(LogfileFD);     /* always close */
     if (Config.Log.rotateNumber > 0) {
        snprintf(to, MAXPATHLEN, "%s.%d", fname, 0);
        rename(fname, to);
     }
-    /* Close and reopen the log.  It may have been renamed "manually"
-     * before HUP'ing us. */
-    file_close(LogfileFD);
+    /* Reopen the log.  It may have been renamed "manually" */
     LogfileFD = file_open(fname, O_WRONLY | O_CREAT, NULL, NULL, NULL);
     if (LogfileFD == DISK_ERROR) {
        debug(46, 0) ("accessLogRotate: Cannot open logfile: %s\n", fname);
index 44cf3d1375b51b80e8b5f199e80b26c6b9af1b46..eb6b6e459e4a648ea175fd39d0191255a3b9eeaf 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: useragent.cc,v 1.15 1998/07/22 20:38:05 wessels Exp $
+ * $Id: useragent.cc,v 1.16 1999/01/29 18:31:18 wessels Exp $
  *
  * DEBUG: section 40    User-Agent logging
  * AUTHOR: Joe Ramey <ramey@csc.ti.com>
@@ -89,6 +89,11 @@ useragentRotateLog(void)
        snprintf(to, MAXPATHLEN, "%s.%d", fname, i);
        rename(from, to);
     }
+    if (cache_useragent_log) {
+       file_close(fileno(cache_useragent_log));
+       fclose(cache_useragent_log);
+       cache_useragent_log = NULL;
+    }
     /* Rotate the current log to .0 */
     if (Config.Log.rotateNumber > 0) {
        snprintf(to, MAXPATHLEN, "%s.%d", fname, 0);