On Sun, Mar 6, 2011 at 9:05 PM, Thibaut VARENE <[email protected]> wrote: > On Sun, Mar 6, 2011 at 6:52 PM, Martin Steigerwald <[email protected]> > wrote: >> Am Sunday 06 March 2011 schrieb Thibaut VARENE: > >>> As stated before, the correct solution would be to add another layer of >>> checks during daemon startup, which would assert that the file it's >>> reading is valid (i.e. to begin with "not empty" and "has parseable >>> data"), and fall back to the backup copy otherwise. This, by design, >>> is the correct approach and has /none/ of the drawbacks of your >>> fsync() patch. >>> >>> I would gladly review such a patch. >> >> But thats at least an offer. And it would help BSD as well. Let's see what >> I will do when there will be the next rainy day during my holidays in >> Sevilla. >> >> But until then I likely have a version that works and I will fork it that >> way as long as it serves the purpose of keeping my uptime records data >> safe in a easy and simple way. This is likely to fix the issue *now*, not >> somewhen in the future. And at least I have done something efficient about >> it in the time I had at my hand. > > w/e > > Here's an ugly half-cooked, built but otherwise TOTALLY UNTESTED > braindump patch that tries to implement The Right Thing (tm).
For good measure, this line: + if (!useold && (filestat.st_size <= filestatold.st_size)) should be: + if (!useold && (filestat.st_size < filestatold.st_size)) but it's no big deal -- Thibaut VARENE http://www.parisc-linux.org/~varenet/ -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

