[Libreoffice] [PUSHED] More read(2) / write(2) cleanup in OSL/unx

Julien Chaffraix julien.chaffraix at gmail.com
Sat Apr 30 16:46:50 PDT 2011

Hi Michael,

>        Thanks for that - I've pushed them. They need a little more work though
> (although they are no worse than the original ;-):
>        a) safeWrite needs to check for EINTR as safeRead does.

Atttached is a patch should solve this.

>        b) neither safeRead or safeWrite advance the buffer /
>           data pointer when they get a partial read/write - which
>           is broken.
>                + we should have an unsigned char *ptr for both of
>                  those, and add nWritten or nRead to it each time
>                  we get a partial chunk read.

Ouch, good catch! Attached is another patch for this.

The changes are again available under LGPLv3+/MPL.

>        Otherwise this is nice :-) It would be sexy to have someone (when this
> is all fixed), to isolate and unify all the temp file creation code that
> is used all over the place; not all of it is best practise, and there is
> a lot of dangerous duplication.

Sounds like a worthy goal, do you have some pointers to areas that
duplicate the code?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Handled-EINTR-in-safeWrite.patch
Type: text/x-patch
Size: 1027 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110430/f9438e23/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Properly-advance-the-data-buffer-pointer.patch
Type: text/x-patch
Size: 2085 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110430/f9438e23/attachment-0001.bin>

More information about the LibreOffice mailing list