[Webkit-unassigned] [Bug 39283] Port SharedBuffer to POSIX.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 19 09:10:49 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=39283


Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #56471|review?, commit-queue?      |review+, commit-queue+
               Flag|                            |




--- Comment #5 from Darin Adler <darin at apple.com>  2010-05-19 09:10:49 PST ---
(From update of attachment 56471)
> +#include "FileSystem.h"
> +
> +#include <fcntl.h>
> +#include <sys/stat.h>
> +#include <unistd.h>
> +#include <wtf/text/CString.h>

We put includes in a single paragraph. Not one for "" and a separate one for <>.

> +    char* filename = filenameFromString(filePath);

Can this function ever fail? If so, then I think we need code to handle that case.

> +    size_t totalBytesRead = 0;
> +    ssize_t bytesRead;
> +    while ((bytesRead = read(fd, result->m_buffer.data() + totalBytesRead, bytesToRead - totalBytesRead)) > 0)
> +        totalBytesRead += bytesRead;

If the length of the file increases due to another process writing to it while this function is running, then this will end up calling read with a size of 0. I suppose that's OK and how you're supposed to use the read call.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list