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/11/usr.sbin/fifolog/lib/fifolog_write_poll.c
Directory Properties:
  stable/11/   (props changed)

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

Modified: stable/11/usr.sbin/fifolog/lib/fifolog_write_poll.c
==============================================================================
--- stable/11/usr.sbin/fifolog/lib/fifolog_write_poll.c Fri Aug 28 16:40:33 
2020        (r364920)
+++ stable/11/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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to