Date: Mon, 2 Feb 2009 14:29:15 +0000 (UTC) From: Poul-Henning Kamp <phk@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r188007 - head/usr.sbin/fifolog/lib Message-ID: <200902021429.n12ETFQk099110@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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.geraghty@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902021429.n12ETFQk099110>