Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Aug 2020 16:40:39 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364921 - in stable: 11/usr.sbin/fifolog/lib 12/usr.sbin/fifolog/lib
Message-ID:  <202008281640.07SGedQU058160@repo.freebsd.org>

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



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