From kde-core-devel Fri Feb 06 19:56:39 2009 From: Thiago Macieira Date: Fri, 06 Feb 2009 19:56:39 +0000 To: kde-core-devel Subject: Re: File corruption with KSaveFile on full disk Message-Id: <200902062056.40205.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=123395025611547 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart2438111.WY57y3Yhbs" --nextPart2438111.WY57y3Yhbs Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Michael Pyne wrote: >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. And then there's no reason that the write won't be blocked in the hard=20 drive's own buffers. There's a point where the effort becomes too great. =2D-=20 Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org PGP/GPG: 0x6EF45358; fingerprint: E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358 --nextPart2438111.WY57y3Yhbs Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQBJjJX4M/XwBW70U1gRAkMjAJ0ehMnx2QHZ0VHTU6rxmp6q7950AQCgwLfj 52cJEY5f/ZWJtl+yNXChmZ0= =Yei1 -----END PGP SIGNATURE----- --nextPart2438111.WY57y3Yhbs--