[llvm] r208396 - MemoryBuffer: don't force mmap when stat fails
Alp Toker
alp at nuanti.com
Fri May 9 01:57:34 PDT 2014
Author: alp
Date: Fri May 9 03:57:32 2014
New Revision: 208396
URL: http://llvm.org/viewvc/llvm-project?rev=208396&view=rev
Log:
MemoryBuffer: don't force mmap when stat fails
Fix error handling introduced in r127426 that could result in MemoryBuffers not
having null termination.
Modified:
llvm/trunk/lib/Support/MemoryBuffer.cpp
Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=208396&r1=208395&r2=208396&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Fri May 9 03:57:32 2014
@@ -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();
}
More information about the llvm-commits
mailing list