1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +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:
Alp Toker 2014-05-09 08:57:32 +00:00
parent 0c76c7e110
commit ece806e295

View File

@ -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();
} }