File corruption with KSaveFile on full disk

Michael Pyne mpyne at purinchu.net
Fri Feb 6 19:37:47 GMT 2009


On Friday 06 February 2009, David Faure wrote:
> On Tuesday 20 January 2009, Thiago Macieira wrote:
> > The problem with buffered mode is that write() will report that it wrote
> > all bytes, but the saving of them to disk might fail. In that case, the
> > write happens inside flush()
>
> So a solution is to test the return value of flush(), right? That's
> actually easier than checking each and every write() call... (and much more
> performant than using Unbuffered).
>
> When does flush happen if not called explicitely? In close? So we should do
> this?

There's no guarantee that in buffered mode write() won't actually have to 
write to disk though, is there?  We know that pending changes will have been 
written out by flush() but there's no reason that write() won't actually write 
if its own internal buffers fill up.

Regards,
 - Michael Pyne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090206/34661782/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090206/34661782/attachment.sig>


More information about the kde-core-devel mailing list