svn commit: r362718 - head/usr.sbin/fifolog/lib
Adrian Chadd
adrian at FreeBSD.org
Sun Jun 28 06:52:39 UTC 2020
Author: adrian
Date: Sun Jun 28 06:52:39 2020
New Revision: 362718
URL: https://svnweb.freebsd.org/changeset/base/362718
Log:
[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
Modified:
head/usr.sbin/fifolog/lib/fifolog_write_poll.c
Modified: head/usr.sbin/fifolog/lib/fifolog_write_poll.c
==============================================================================
--- head/usr.sbin/fifolog/lib/fifolog_write_poll.c Sun Jun 28 04:08:42 2020 (r362717)
+++ head/usr.sbin/fifolog/lib/fifolog_write_poll.c Sun Jun 28 06:52:39 2020 (r362718)
@@ -239,6 +239,14 @@ fifolog_write_output(struct fifolog_writer *f, int fl,
*/
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);
More information about the svn-src-head
mailing list