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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to