From kde-core-devel Tue Jan 20 10:40:57 2009 From: Thiago Macieira Date: Tue, 20 Jan 2009 10:40:57 +0000 To: kde-core-devel Subject: Re: File corruption with KSaveFile on full disk Message-Id: <200901201140.57917.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=123244814006585 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart2010364.pu8UMlnIiN" --nextPart2010364.pu8UMlnIiN Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Em Ter=E7a-feira 20 Janeiro 2009, =E0s 00:40:43, David Faure escreveu: > On Sunday 18 January 2009, Thiago Macieira wrote: > > Michael Leupold wrote: > > >I seem to have to check the return value and use waitForBytesWritten() > > > unless I'm using unbuffered output as QIODevice::write() might (will?) > > > return the number of bytes I tried to write even if the disk is full. > > > That's at least what a simple test suggests. > > > > Use an unbuffered QFile and check the return value of write(). > > Wow, we do the latter already in saving-code (KZip, KOffice, ...), > but we don't use Unbuffered mode... It worked in qt3/kde3 without > unbuffered, I'm sure. The problem with buffered mode is that write() will report that it wrote al= l=20 bytes, but the saving of them to disk might fail. In that case, the write=20 happens inside flush() (not in waitForBytesWritten, which is a No-Op in QFi= le). =2D-=20 Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Senior Software Engineer - Nokia, Qt Software Qt Software is hiring - ask me =A0 =A0 PGP/GPG: 0x6EF45358; fingerprint: =A0 =A0 E067 918B B660 DBD1 105C =A0966C 33F5 F005 6EF4 5358 --nextPart2010364.pu8UMlnIiN 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) iD8DBQBJdao5M/XwBW70U1gRAo/SAJ9T5D9ku3Ln4/0yKPq34vXQ1xNGVACeLDBx WCL49yErfQu5r5pqpGa6WZ4= =pA7p -----END PGP SIGNATURE----- --nextPart2010364.pu8UMlnIiN--