diff -Naur logrotate-3.7.7/logrotate.c logrotate-3.7.7-magellan/logrotate.c --- logrotate-3.7.7/logrotate.c 2008-05-14 12:31:35.000000000 +0200 +++ logrotate-3.7.7-magellan/logrotate.c 2008-10-14 23:53:47.000000000 +0200 @@ -512,13 +512,17 @@ switch (log->criterium) { case ROT_WEEKLY: /* rotate if: - 1) the current weekday is before the weekday of the - last rotation + 1) the day of the week is the same as the day of the week of + the previous rotation but not the same day of the year + this will rotate it on the same day every week, but not + twice a day. 2) more then a week has passed since the last rotation */ - state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday) - || - ((mktime(&now) - + state->doRotate = ((now.tm_wday == state->lastRotated.tm_wday + && + now.tm_yday != state->lastRotated.tm_yday) + || + ((mktime(&now) - mktime(&state->lastRotated)) > (7 * 24 * 3600))); break;