[llvm-commits] [llvm] r85922 - /llvm/trunk/lib/Support/MemoryBuffer.cpp
Duncan Sands
baldrick at free.fr
Tue Nov 3 11:10:22 PST 2009
Author: baldrick
Date: Tue Nov 3 13:10:22 2009
New Revision: 85922
URL: http://llvm.org/viewvc/llvm-project?rev=85922&view=rev
Log:
Make this code more robust by not thinking we are making progress
if zero bytes were read.
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=85922&r1=85921&r2=85922&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Tue Nov 3 13:10:22 2009
@@ -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) {
More information about the llvm-commits
mailing list