Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jun 2020 06:52:39 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362718 - head/usr.sbin/fifolog/lib
Message-ID:  <202006280652.05S6qdrd088832@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006280652.05S6qdrd088832>