Make sure to update the mtime of a logfile after archiving it. This

ensures that the next rotation happens at the correct time when using
interval-based rotations.

PR:		bin/174438
Reviewed by:	gad
Approved by:	rstone (co-mentor)
MFC after:	1 week
This commit is contained in:
Mark Johnston 2013-01-03 16:14:51 +00:00
parent 468d206524
commit 9df22a6e88
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244997

View File

@ -1814,12 +1814,21 @@ do_rotate(const struct conf_entry *ent)
printf("\tcp %s %s\n", ent->log, file1);
else
printf("\tln %s %s\n", ent->log, file1);
printf("\ttouch %s\t\t"
"# Update mtime for 'when'-interval processing\n",
file1);
} else {
if (!(flags & CE_BINARY)) {
/* Report the trimming to the old log */
log_trim(ent->log, ent);
}
savelog(ent->log, file1);
/*
* Interval-based rotations are done using the mtime of
* the most recently archived log, so make sure it gets
* updated during a rotation.
*/
utimes(file1, NULL);
}
change_attrs(file1, ent);
}