Contents of /trunk/logrotate/patches/logrotate-3.7.1-weekly.patch
Parent Directory | Revision Log
Revision 153 -
(show annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 5 months ago) by niro
File size: 1165 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 5 months ago) by niro
File size: 1165 byte(s)
-import
1 | --- logrotate-3.7.1-old/logrotate.c 2004-10-19 23:41:24.000000000 +0200 |
2 | +++ logrotate-3.7.1-new/logrotate.c 2005-10-02 17:29:22.380767321 +0200 |
3 | @@ -424,12 +424,15 @@ int findNeedRotating(logInfo * log, int |
4 | switch (log->criterium) { |
5 | case ROT_WEEKLY: |
6 | /* rotate if: |
7 | - 1) the current weekday is before the weekday of the |
8 | - last rotation |
9 | + 1) the day of the week is the same as the day of the week of |
10 | + the previous rotation but not the same day of the year |
11 | + this will rotate it on the same day every week, but not |
12 | + twice a day. |
13 | 2) more then a week has passed since the last |
14 | rotation */ |
15 | - state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday) || |
16 | - ((mktime(&now) - mktime(&state->lastRotated)) > |
17 | + state->doRotate = ((now.tm_wday == state->lastRotated.tm_wday && |
18 | + now.tm_yday != state->lastRotated.tm_yday) || |
19 | + ((mktime(&now) - mktime(&state->lastRotated)) > |
20 | (7 * 24 * 3600))); |
21 | break; |
22 | case ROT_MONTHLY: |