]> granicus.if.org Git - llvm/commit
Recommit "MemoryBuffer: Add a missing error-check to getOpenFileImpl"
authorPavel Labath <pavel@labath.sk>
Tue, 20 Aug 2019 12:08:52 +0000 (12:08 +0000)
committerPavel Labath <pavel@labath.sk>
Tue, 20 Aug 2019 12:08:52 +0000 (12:08 +0000)
commit01410fc2a6ea9d5bef7db124ef24fec15eae8a25
treea30273599a64e3e7ac24d51260441b55407bb050
parent301861b35821b6d311d49ee4becac95a31743932
Recommit "MemoryBuffer: Add a missing error-check to getOpenFileImpl"

This recommits r368977, which was reverted in r369027 due to test
failures in lldb. The cause of this was different behavior of
readNativeFileSlice on windows and unix. These have been addressed in
r369269.

The original commit message was:
In case the function was called with a desired read size *and* the file
was not an "mmap()" candidate, the function was falling back to a
"pread()", but it was failing to check the result of that system call.
This meant that the function would return "success" even though the read
operation failed, and it returned a buffer full of uninitialized memory.

Reviewers: rnk, dblaikie

Subscribers: kristina, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66224

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369370 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/MemoryBuffer.cpp
unittests/Support/MemoryBufferTest.cpp