diff --exclude-from=/home/dang/.scripts/diffrc -up -ruN logrotate-3.7.7.orig/logrotate.c logrotate-3.7.7/logrotate.c --- logrotate-3.7.7.orig/logrotate.c 2008-05-14 06:31:35.000000000 -0400 +++ logrotate-3.7.7/logrotate.c 2008-12-23 11:14:55.000000000 -0500 @@ -512,16 +512,17 @@ int findNeedRotating(struct logInfo *log 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) - - mktime(&state->lastRotated)) > + 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; + break; case ROT_MONTHLY: /* rotate if the logs haven't been rotated this month or this year */