Make this code more robust by not thinking we are making progress
if zero bytes were read.
llvm-svn: 85922
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index e35c626..d8b6b9f 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -226,7 +226,7 @@
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) {