提交 8f2579a9 编写于 作者: Y Yun Peng 提交者: drpngx

Fix a bug in windows_file_system.cc for reading file (#6805)

When read_result is TRUE, result should be set to bytes_read.
上级 018583b0
......@@ -72,7 +72,9 @@ SSIZE_T pread(HANDLE hfile, char* src, size_t num_bytes, uint64_t offset) {
BOOL read_result = ::ReadFile(hfile, src, static_cast<DWORD>(num_bytes),
&bytes_read, &overlapped);
if ((FALSE == read_result) &&
if (TRUE == read_result) {
result = bytes_read;
} else if ((FALSE == read_result) &&
((last_error = GetLastError()) != ERROR_IO_PENDING)) {
result = (last_error == ERROR_HANDLE_EOF) ? 0 : -1;
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册