diff options
author | Duncan Sands <baldrick@free.fr> | 2009-11-03 19:10:22 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-11-03 19:10:22 +0000 |
commit | 954cb43c8075a66390de9357595ca6069d86941c (patch) | |
tree | 86f2a5b736bd59987e9d596e69c5a6e8917264dd /lib/Support/MemoryBuffer.cpp | |
parent | e8bc45a645f1df1c9f8b23c6f29247a61af14f19 (diff) |
Make this code more robust by not thinking we are making progress
if zero bytes were read.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/MemoryBuffer.cpp')
-rw-r--r-- | lib/Support/MemoryBuffer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp index e35c626c40..d8b6b9f76f 100644 --- a/lib/Support/MemoryBuffer.cpp +++ b/lib/Support/MemoryBuffer.cpp @@ -226,7 +226,7 @@ MemoryBuffer *MemoryBuffer::getFile(const char *Filename, std::string *ErrStr, size_t BytesLeft = FileSize; while (BytesLeft) { ssize_t NumRead = ::read(FD, BufPtr, BytesLeft); - if (NumRead != -1) { + if (NumRead > 0) { BytesLeft -= NumRead; BufPtr += NumRead; } else if (errno == EINTR) { |