Annotation of /trunk/logrotate/patches/logrotate-3.7.7-weekly.patch
Parent Directory | Revision Log
Revision 703 -
(hide annotations)
(download)
Tue Oct 14 22:21:29 2008 UTC (15 years, 11 months ago) by niro
File size: 1075 byte(s)
Tue Oct 14 22:21:29 2008 UTC (15 years, 11 months ago) by niro
File size: 1075 byte(s)
-re-diffed for 3.7.7
1 | niro | 703 | diff -Naur logrotate-3.7.7/logrotate.c logrotate-3.7.7-magellan/logrotate.c |
2 | --- logrotate-3.7.7/logrotate.c 2008-05-14 12:31:35.000000000 +0200 | ||
3 | +++ logrotate-3.7.7-magellan/logrotate.c 2008-10-14 23:53:47.000000000 +0200 | ||
4 | @@ -512,13 +512,17 @@ | ||
5 | switch (log->criterium) { | ||
6 | case ROT_WEEKLY: | ||
7 | /* rotate if: | ||
8 | - 1) the current weekday is before the weekday of the | ||
9 | - last rotation | ||
10 | + 1) the day of the week is the same as the day of the week of | ||
11 | + the previous rotation but not the same day of the year | ||
12 | + this will rotate it on the same day every week, but not | ||
13 | + twice a day. | ||
14 | 2) more then a week has passed since the last | ||
15 | rotation */ | ||
16 | - state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday) | ||
17 | - || | ||
18 | - ((mktime(&now) - | ||
19 | + state->doRotate = ((now.tm_wday == state->lastRotated.tm_wday | ||
20 | + && | ||
21 | + now.tm_yday != state->lastRotated.tm_yday) | ||
22 | + || | ||
23 | + ((mktime(&now) - | ||
24 | mktime(&state->lastRotated)) > | ||
25 | (7 * 24 * 3600))); | ||
26 | break; |