[fifolog] wrap the recno when we hit the end of the provided file size.

Without this the log just keeps growing to infinity.

Reviewed by:	phk
Differential Revision:	https://reviews.freebsd.org/D25478
This commit is contained in:
adrian 2020-06-28 06:52:39 +00:00
parent 661f178661
commit ab99701b80

View File

@ -239,6 +239,14 @@ fifolog_write_output(struct fifolog_writer *f, int fl, time_t now)
*/
f->seq++;
f->recno++;
/*
* Ensure we wrap recno once we hit the file size (in records.)
*/
if (f->recno >= f->ff->logsize)
/* recno 0 is header; skip */
f->recno = 1;
f->flag = 0;
memset(f->obuf, 0, f->obufsize);