[llvm-commits] [llvm] r85922 - /llvm/trunk/lib/Support/MemoryBuffer.cpp
Duncan Sands
baldrick at free.fr
Tue Nov 3 12:08:31 PST 2009
Hi Dan,
>> --- 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) {
>
> Given this, the code should explicitly set errno to 0 so that it doesn't
> infinite loop if it reaches the end of the file and errno happens to
> have the value EINTR.
if errno is EINTR, isn't it correct to go around again, even if zero bytes
were read?
Ciao,
Duncan.
More information about the llvm-commits
mailing list