aboutsummaryrefslogtreecommitdiff
path: root/lib/base/buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/base/buffer.cpp')
-rw-r--r--lib/base/buffer.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/base/buffer.cpp b/lib/base/buffer.cpp
index 07e9d7f1..9839b3e8 100644
--- a/lib/base/buffer.cpp
+++ b/lib/base/buffer.cpp
@@ -120,23 +120,22 @@ int eIOBuffer::fromfile(int fd, int len)
while (len)
{
int tc=len;
- int r;
+ int r=0;
if (buffer.empty() || (allocationsize == buffer.back().len))
addblock();
if (tc > allocationsize-buffer.back().len)
tc=allocationsize-buffer.back().len;
r=::read(fd, buffer.back().data+buffer.back().len, tc);
buffer.back().len+=r;
- len-=r;
- if (r < 0)
+ if (r < 0 && errno != EWOULDBLOCK )
+ eDebug("couldn't read: %m");
+ else
{
- if (errno != EWOULDBLOCK)
- eDebug("read: %m");
- r=0;
+ len-=r;
+ re+=r;
+ if (r != tc)
+ break;
}
- re+=r;
- if (r != tc)
- break;
}
return re;
}