From: wessels <> Date: Thu, 16 Jan 1997 01:41:47 +0000 (+0000) Subject: only rotate logs which are regular files X-Git-Tag: SQUID_3_0_PRE1~5200 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2edc250474e9d889acccaf16d03b0eef99ff569a;p=thirdparty%2Fsquid.git only rotate logs which are regular files --- diff --git a/src/debug.cc b/src/debug.cc index d8dbeacc9d..e57da3e593 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,5 +1,5 @@ /* - * $Id: debug.cc,v 1.40 1997/01/07 20:05:42 wessels Exp $ + * $Id: debug.cc,v 1.41 1997/01/15 18:41:47 wessels Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -247,9 +247,13 @@ _db_rotate_log(void) int i; LOCAL_ARRAY(char, from, MAXPATHLEN); LOCAL_ARRAY(char, to, MAXPATHLEN); + struct stat sb; if (debug_log_file == NULL) return; + if (stat(debug_log_file, &sb) == 0) + if (S_ISREG(sb.st_mode) == 0) + return; /* Rotate numbers 0 through N up one */ for (i = Config.Log.rotateNumber; i > 1;) { diff --git a/src/stat.cc b/src/stat.cc index 0725dd3771..e355dfd1e7 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.116 1997/01/13 22:58:03 wessels Exp $ + * $Id: stat.cc,v 1.117 1997/01/15 18:41:48 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1342,9 +1342,13 @@ stat_rotate_log(void) LOCAL_ARRAY(char, from, MAXPATHLEN); LOCAL_ARRAY(char, to, MAXPATHLEN); char *fname = NULL; + struct stat sb; if ((fname = HTTPCacheInfo->logfilename) == NULL) return; + if (stat(fname, &sb) == 0) + if (S_ISREG(sb.st_mode) == 0) + return; debug(18, 1, "stat_rotate_log: Rotating\n"); diff --git a/src/store.cc b/src/store.cc index de38dc4b5f..1c1b0bc818 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.191 1997/01/15 18:35:33 wessels Exp $ + * $Id: store.cc,v 1.192 1997/01/15 18:41:49 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -2538,7 +2538,7 @@ storeMaintainSwapSpace(void *unused) return; #ifdef AUTO_ADJUST_REF_AGE - storeAdjustReferenceAge(); + storeAdjustReferenceAge(); #endif /* Purges expired objects, check one bucket on each calling */ @@ -2697,6 +2697,7 @@ storeRotateLog(void) int i; LOCAL_ARRAY(char, from, MAXPATHLEN); LOCAL_ARRAY(char, to, MAXPATHLEN); + struct stat sb; if (storelog_fd > -1) { file_close(storelog_fd); @@ -2704,9 +2705,11 @@ storeRotateLog(void) } if ((fname = Config.Log.store) == NULL) return; - if (strcmp(fname, "none") == 0) return; + if (stat(fname, &sb) == 0) + if (S_ISREG(sb.st_mode) == 0) + return; debug(20, 1, "storeRotateLog: Rotating.\n"); @@ -2796,6 +2799,7 @@ storeAdjustReferenceAge(void) (int) delta, (int) Config.referenceAge); last_above = above; } + #endif static const char * diff --git a/src/useragent.cc b/src/useragent.cc index 40fa1c0908..d76f1f0999 100644 --- a/src/useragent.cc +++ b/src/useragent.cc @@ -1,6 +1,6 @@ /* - * $Id: useragent.cc,v 1.2 1996/11/14 18:38:51 wessels Exp $ + * $Id: useragent.cc,v 1.3 1997/01/15 18:41:50 wessels Exp $ * * DEBUG: section 40 User-Agent logging * AUTHOR: Joe Ramey @@ -69,10 +69,14 @@ useragentRotateLog(void) int i; LOCAL_ARRAY(char, from, MAXPATHLEN); LOCAL_ARRAY(char, to, MAXPATHLEN); + struct stat sb; if ((fname = Config.Log.useragent) == NULL) return; if (strcmp(fname, "none") == 0) return; + if (stat(fname, &sb) == 0) + if (S_ISREG(sb.st_mode) == 0) + return; debug(40, 1, "useragentRotateLog: Rotating.\n"); /* Rotate numbers 0 through N up one */ for (i = Config.Log.rotateNumber; i > 1;) {