mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-13 16:03:58 +00:00
MemoryBuffer: don't force mmap when stat fails
Fix error handling introduced in r127426 that could result in MemoryBuffers not having null termination. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208396 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
87ccb2bffd
commit
8d24d43c95
@ -320,9 +320,8 @@ static bool shouldUseMmap(int FD,
|
||||
// RequiresNullTerminator = false and MapSize != -1.
|
||||
if (FileSize == size_t(-1)) {
|
||||
sys::fs::file_status Status;
|
||||
error_code EC = sys::fs::status(FD, Status);
|
||||
if (EC)
|
||||
return EC;
|
||||
if (sys::fs::status(FD, Status))
|
||||
return false;
|
||||
FileSize = Status.getSize();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user