| Index: base/platform_file_posix.cc
|
| ===================================================================
|
| --- base/platform_file_posix.cc (revision 97736)
|
| +++ base/platform_file_posix.cc (working copy)
|
| @@ -155,10 +155,21 @@
|
|
|
| int WritePlatformFile(PlatformFile file, int64 offset,
|
| const char* data, int size) {
|
| - if (file < 0)
|
| + if (file < 0 || size < 0)
|
| return -1;
|
|
|
| - return HANDLE_EINTR(pwrite(file, data, size, offset));
|
| + int bytes_written = 0;
|
| + int rv;
|
| + do {
|
| + rv = HANDLE_EINTR(pwrite(file, data + bytes_written,
|
| + size - bytes_written, offset + bytes_written));
|
| + if (rv <= 0)
|
| + break;
|
| +
|
| + bytes_written += rv;
|
| + } while (bytes_written < size);
|
| +
|
| + return bytes_written ? bytes_written : rv;
|
| }
|
|
|
| bool TruncatePlatformFile(PlatformFile file, int64 length) {
|
|
|