Chromium Code Reviews| Index: util/file/file_io_win.cc |
| diff --git a/util/file/file_io_win.cc b/util/file/file_io_win.cc |
| index 861f15acc64e2243c2b5d024bc68f7b947ff15e4..264cc4342e026f40dd2051637c6c6279d4277414 100644 |
| --- a/util/file/file_io_win.cc |
| +++ b/util/file/file_io_win.cc |
| @@ -44,7 +44,12 @@ ssize_t ReadFile(FileHandle file, void* buffer, size_t size) { |
| while (size_dword > 0) { |
| DWORD bytes_read; |
| BOOL success = ::ReadFile(file, buffer_c, size_dword, &bytes_read, nullptr); |
| - if (!success && GetLastError() != ERROR_MORE_DATA) { |
| + if (!success && GetLastError() == ERROR_BROKEN_PIPE) { |
|
Mark Mentovai
2015/01/28 19:58:27
A light restructuring to keep rechecking the same
scottmg
2015/01/28 22:14:57
Done.
|
| + // When reading a pipe and the write handle has been closed, ReadFile |
| + // fails with ERROR_BROKEN_PIPE, but only once all pending data has been |
| + // read. |
| + break; |
| + } else if (!success && GetLastError() != ERROR_MORE_DATA) { |
| return -1; |
| } else if (success && bytes_read == 0 && |
| GetFileType(file) != FILE_TYPE_PIPE) { |