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 | 4afa0838d721853d88564bbc2d747e469f43574c (patch) | |
tree | 760a4319532cc43f11b64bd3803b4c0778c56e9a | |
parent | 1cb5116292ca6bb2c0e8c8b8dfa1c799cb80797a (diff) | |
download | bcm5719-llvm-4afa0838d721853d88564bbc2d747e469f43574c.tar.gz bcm5719-llvm-4afa0838d721853d88564bbc2d747e469f43574c.zip |
Make this code more robust by not thinking we are making progress
if zero bytes were read.
llvm-svn: 85922
-rw-r--r-- | llvm/lib/Support/MemoryBuffer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp index e35c626c408..d8b6b9f76fe 100644 --- a/llvm/lib/Support/MemoryBuffer.cpp +++ b/llvm/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) { |