mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-15 16:07:49 +00:00
Make this code more robust by not thinking we are making progress
if zero bytes were read. llvm-svn: 85922
This commit is contained in:
parent
5b0aaf3a1f
commit
d4b8f9ee93
@ -226,7 +226,7 @@ MemoryBuffer *MemoryBuffer::getFile(const char *Filename, std::string *ErrStr,
|
|||||||
size_t BytesLeft = FileSize;
|
size_t BytesLeft = FileSize;
|
||||||
while (BytesLeft) {
|
while (BytesLeft) {
|
||||||
ssize_t NumRead = ::read(FD, BufPtr, BytesLeft);
|
ssize_t NumRead = ::read(FD, BufPtr, BytesLeft);
|
||||||
if (NumRead != -1) {
|
if (NumRead > 0) {
|
||||||
BytesLeft -= NumRead;
|
BytesLeft -= NumRead;
|
||||||
BufPtr += NumRead;
|
BufPtr += NumRead;
|
||||||
} else if (errno == EINTR) {
|
} else if (errno == EINTR) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user