2
Patch from: Holger Weiss <holger@ZEDAT.FU-Berlin.DE>
4
If you call logrotate once a week between 00:00 and 01:00 AM and
5
daylight saving time is in effect, "weekly" rotations will be done only
6
once in two weeks. E.g., the following crontab won't work as expected:
8
12 0 * * 1 /usr/sbin/logrotate
10
logrotate uses the tm struct "lastRotated" in order to find out whether
11
a logfile needs rotating. "lastRotated" is filled by first setting
12
everything to zero, then setting the mday, month and year of the last
13
rotation and then calling mktime(3) in order to normalize the rest of
14
the struct. The problem is that if daylight saving time is in effect,
15
mktime() will increment "lastRotated.tm_isdst" from 0 to 1 and push
16
"lastRotated" by one hour. Hence, the current time will be compared
17
with the day of the last rotation, 01:00 AM. This can be solved by
18
setting lastRotated.tm_isdst correctly prior to the mktime() call.
21
Index: logrotate-3.7.1/logrotate.c
22
===================================================================
23
--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 21:36:03.268110593 +0100
24
+++ logrotate-3.7.1/logrotate.c 2006-04-08 21:36:11.342764986 +0100
26
states[i].lastRotated.tm_mon = now.tm_mon;
27
states[i].lastRotated.tm_mday = now.tm_mday;
28
states[i].lastRotated.tm_year = now.tm_year;
29
+ states[i].lastRotated.tm_isdst = now.tm_isdst;
31
/* fill in the rest of the st->lastRotated fields */
32
lr_time = mktime(&states[i].lastRotated);