I found out the hard way that our file write handling needs some
improvement.  Granted it's not a common case, but it's a potentially
ugly one.

I accidentally filled up a partition while working in GnuCash the
other day and though GnuCash gave me no warning, when I came back to
the file later, it was unreadable (corrupted -- short, or whatever).

This means we need to improve our file write handling.  At the very
least, if we're not already, we should:

  1) Check the return code from all writes and do something if there's
     an error.

  2) Check the return code from close() or fclose() and do the same.

  3) best yet, do writes in two stages, write to a temp file in the
     same directory, then unlink the original iff the write and final
     close succeed, then rename the copy to the original name. (or
     some similar algorithm at least as safe).

Perhaps we already do some of this, but we're definitely missing
something.  I'll look in to it myself when I get a chance if no one
else gets to it first...

-- 
Rob Browning <[EMAIL PROTECTED]> PGP=E80E0D04F521A094 532B97F5D64E3930
----- %< -------------------------------------------- >% ------
The GnuCash / X-Accountant Mailing List
To unsubscribe, send mail to [EMAIL PROTECTED] and
put "unsubscribe gnucash-devel [EMAIL PROTECTED]" in the body

Reply via email to