From: wessels <> Date: Sat, 30 Jan 1999 01:31:17 +0000 (+0000) Subject: close files before renaming for lame microsoft-ish operating systems. X-Git-Tag: SQUID_3_0_PRE1~2333 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9b5f6d0a3450e0b653dce98aae4bdb52b6fc6f6;p=thirdparty%2Fsquid.git close files before renaming for lame microsoft-ish operating systems. --- diff --git a/src/access_log.cc b/src/access_log.cc index 2fbef20b15..334d571dec 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -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); diff --git a/src/useragent.cc b/src/useragent.cc index 44cf3d1375..eb6b6e459e 100644 --- a/src/useragent.cc +++ b/src/useragent.cc @@ -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 @@ -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);