diff options
author | Alp Toker <alp@nuanti.com> | 2014-05-09 08:57:32 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-05-09 08:57:32 +0000 |
commit | c7bd4d24d9243499a3758ba6a6fd1a3aa2eac641 (patch) | |
tree | 194cfa0ad25d7959fabc974c3b6f64d2340151d9 /llvm/lib/Support | |
parent | bf8960301df73b4ffe957cc76a94af248dd7ea21 (diff) | |
download | bcm5719-llvm-c7bd4d24d9243499a3758ba6a6fd1a3aa2eac641.tar.gz bcm5719-llvm-c7bd4d24d9243499a3758ba6a6fd1a3aa2eac641.zip |
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
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/MemoryBuffer.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp index f95383dfb29..26c3a2ebd26 100644 --- a/llvm/lib/Support/MemoryBuffer.cpp +++ b/llvm/lib/Support/MemoryBuffer.cpp @@ -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(); } |