mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
MemoryBuffer: don't force mmap when stat fails
Fix error handling introduced in r127426 that could result in MemoryBuffers not having null termination. llvm-svn: 208396
This commit is contained in:
parent
0c76c7e110
commit
ece806e295
@ -320,9 +320,8 @@ static bool shouldUseMmap(int FD,
|
|||||||
// RequiresNullTerminator = false and MapSize != -1.
|
// RequiresNullTerminator = false and MapSize != -1.
|
||||||
if (FileSize == size_t(-1)) {
|
if (FileSize == size_t(-1)) {
|
||||||
sys::fs::file_status Status;
|
sys::fs::file_status Status;
|
||||||
error_code EC = sys::fs::status(FD, Status);
|
if (sys::fs::status(FD, Status))
|
||||||
if (EC)
|
return false;
|
||||||
return EC;
|
|
||||||
FileSize = Status.getSize();
|
FileSize = Status.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user