svn commit: r364921 - in stable: 11/usr.sbin/fifolog/lib 12/usr.sbin/fifolog/lib

Glen Barber gjb at FreeBSD.org
Fri Aug 28 16:40:39 UTC 2020


Author: gjb
Date: Fri Aug 28 16:40:38 2020
New Revision: 364921
URL: https://svnweb.freebsd.org/changeset/base/364921

Log:
  MFC r362718 (adrian):
   [fifolog] wrap the recno when we hit the end of the provided file size.
  
   Without this the log just keeps growing to infinity.
  
  Reported by:	phk
  Sponsored by:	Rubicon Communications, LLC (netgate.com)

Modified:
  stable/12/usr.sbin/fifolog/lib/fifolog_write_poll.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.sbin/fifolog/lib/fifolog_write_poll.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/usr.sbin/fifolog/lib/fifolog_write_poll.c
==============================================================================
--- stable/12/usr.sbin/fifolog/lib/fifolog_write_poll.c	Fri Aug 28 16:40:33 2020	(r364920)
+++ stable/12/usr.sbin/fifolog/lib/fifolog_write_poll.c	Fri Aug 28 16:40:38 2020	(r364921)
@@ -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-all mailing list