Chromium Code Reviews| Index: base/file_util_posix.cc |
| diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc |
| index e2eb2f89ac09464bdb817c9798740b2979d149d3..73de948f6f65470f07d7877898956fcce03a4698 100644 |
| --- a/base/file_util_posix.cc |
| +++ b/base/file_util_posix.cc |
| @@ -651,13 +651,13 @@ FILE* OpenFile(const FilePath& filename, const char* mode) { |
| return result; |
| } |
| -int ReadFile(const FilePath& filename, char* data, int size) { |
| +int ReadFile(const FilePath& filename, char* data, int max_size) { |
| ThreadRestrictions::AssertIOAllowed(); |
| int fd = HANDLE_EINTR(open(filename.value().c_str(), O_RDONLY)); |
| if (fd < 0) |
| return -1; |
| - ssize_t bytes_read = HANDLE_EINTR(read(fd, data, size)); |
| + ssize_t bytes_read = HANDLE_EINTR(read(fd, data, max_size)); |
|
Mark Mentovai
2014/04/17 16:21:57
I kinda feel like if this was a short read but EOF
fukino
2014/04/18 02:22:12
Thank you for suggestion!
I didn't realize any cas
|
| if (int ret = IGNORE_EINTR(close(fd)) < 0) |
|
Mark Mentovai
2014/04/17 16:21:57
You don’t need to track |ret| here, you can just
fukino
2014/04/18 02:22:12
Done for ReadFile(), WriteFile() and AppendToFile(
|
| return ret; |
| return bytes_read; |