[packages] logrotate: update to v3.7.8
[packages.git] / utils / logrotate / patches / 006-weekly.patch
1 --- a/logrotate.c
2 +++ b/logrotate.c
3 @@ -567,9 +567,14 @@ int findNeedRotating(struct logInfo *log
4             /* rotate if:
5                1) the current weekday is before the weekday of the
6                last rotation
7 +              1) the day of the week is the same as the day of the week of
8 +              the previous rotation but not the same day of the year
9 +              this will rotate it on the same day every week, but not
10 +              twice a day.
11                2) more then a week has passed since the last
12                rotation */
13 -           state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday)
14 +           state->doRotate = ((now.tm_wday == state->lastRotated.tm_wday
15 +                                    && now.tm_yday != state->lastRotated.tm_yday)
16                                ||
17                                ((mktime(&now) -
18                                  mktime(&state->lastRotated)) >