diff options
author | Pavel Labath <pavel@labath.sk> | 2019-08-19 15:40:49 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2019-08-19 15:40:49 +0000 |
commit | 08c77b97c0620b3d8e058e4780bb4f62d81c5958 (patch) | |
tree | c8cc659807db51ecd17d7dd33a5d2fd1e36f5476 /llvm/lib/Support/Windows/Path.inc | |
parent | edfaee08115376467d1c95573de991aebfdaeb42 (diff) | |
download | bcm5719-llvm-08c77b97c0620b3d8e058e4780bb4f62d81c5958.tar.gz bcm5719-llvm-08c77b97c0620b3d8e058e4780bb4f62d81c5958.zip |
Filesystem/Windows: fix inconsistency in readNativeFileSlice API
Summary:
The windows version implementation of readNativeFileSlice, was trying to
match the POSIX behavior of not treating EOF as an error, but it was
only handling the case of reading from a pipe. Attempting to read past
the end of a regular file returns a slightly different error code, which
needs to be handled too. This patch adds ERROR_HANDLE_EOF to the list of
error codes to be treated as an end of file, and adds some unit tests
for the API.
This issue was found while attempting to land D66224, which caused a bunch of
lldb tests to start failing on windows.
Reviewers: rnk, aganea
Subscribers: kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66344
llvm-svn: 369269
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r-- | llvm/lib/Support/Windows/Path.inc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc index 5704930aeec..00a4e669abb 100644 --- a/llvm/lib/Support/Windows/Path.inc +++ b/llvm/lib/Support/Windows/Path.inc @@ -1229,8 +1229,8 @@ std::error_code readNativeFileImpl(file_t FileHandle, char *BufPtr, size_t Bytes *BytesRead = BytesRead32; if (!Success) { DWORD Err = ::GetLastError(); - // Pipe EOF is not an error. - if (Err == ERROR_BROKEN_PIPE) + // EOF is not an error. + if (Err == ERROR_BROKEN_PIPE || Err == ERROR_HANDLE_EOF) return std::error_code(); return mapWindowsError(Err); } |