aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryaworsky <yaworsky>2005-09-16 10:20:51 +0000
committeryaworsky <yaworsky>2005-09-16 10:20:51 +0000
commit0ac4bd4fdf06aee63cfc529a561ac7f506f9ae1b (patch)
tree259f1fcb200cbea530c21d758a32395e7828040d
parentf5b4965699765375078f4feee8cd3a5c03d5b6ca (diff)
downloadsyslog-win32-0ac4bd4fdf06aee63cfc529a561ac7f506f9ae1b.tar.gz
syslog-win32-0ac4bd4fdf06aee63cfc529a561ac7f506f9ae1b.tar.xz
syslog-win32-0ac4bd4fdf06aee63cfc529a561ac7f506f9ae1b.zip
Fixed daily and weekly conditions.
-rw-r--r--daemon/logrotate.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/daemon/logrotate.c b/daemon/logrotate.c
index 5b0932a..d759f10 100644
--- a/daemon/logrotate.c
+++ b/daemon/logrotate.c
@@ -238,13 +238,20 @@ void rotate_logfile( const gchar* pathname, struct destination* destination )
break;
goto done;
case RP_WEEKLY:
- if( 0 == tm->tm_wday && fst.st_mtime - fst.st_ctime > 24 * 3600 )
+ {
+ int current_weekday = tm->tm_wday;
+ if( current_weekday < gmtime( &fst.st_ctime )->tm_wday
+ || fst.st_mtime - fst.st_ctime > 7 * 24 * 3600 )
break;
goto done;
+ }
case RP_MONTHLY:
- if( 1 == tm->tm_mday && fst.st_mtime - fst.st_ctime > 24 * 3600 )
+ {
+ int current_month = tm->tm_mon;
+ if( current_month != gmtime( &fst.st_ctime )->tm_mon )
break;
goto done;
+ }
default:
goto done;
}