Author: phk
Date: Mon Feb  2 14:29:15 2009
New Revision: 188007
URL: http://svn.freebsd.org/changeset/base/188007

Log:
  Don't overwrite it, if only one sector is written yet.
  
  Discovered by:        "Dewayne Geraghty" 
<dewayne.gerag...@heuristicsystems.com.au>

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      Mon Feb  2 11:19:56 
2009        (r188006)
+++ head/usr.sbin/fifolog/lib/fifolog_write_poll.c      Mon Feb  2 14:29:15 
2009        (r188007)
@@ -152,15 +152,16 @@ fifolog_write_open(struct fifolog_writer
        es = fifolog_int_findend(f->ff, &o);
        if (es != NULL)
                return (es);
-       if (o == 0) {
-               f->seq = 0;
-               f->recno = 0;
+       i = fifolog_int_read(f->ff, o);
+       if (i)
+               return ("Read error, looking for seq");
+       f->seq = be32dec(f->ff->recbuf);
+       if (f->seq == 0) {
+               /* Empty fifolog */
+               f->seq = random();
        } else {
-               i = fifolog_int_read(f->ff, o);
-               if (i)
-                       return ("Read error, looking for seq");
-               f->seq = be32dec(f->ff->recbuf) + 1;
                f->recno = o + 1;
+               f->seq++;
        }
 
        f->ibufsize = 32768;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to