aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}