summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libfile.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/libfile.c b/lib/libfile.c
index eb12d158d8..814cd9c2cd 100644
--- a/lib/libfile.c
+++ b/lib/libfile.c
@@ -80,20 +80,18 @@ int read_full(int fd, void *buf, size_t size)
{
size_t insize = size;
int now;
- int total = 0;
while (size) {
now = read(fd, buf, size);
if (now == 0)
- return total;
+ break;
if (now < 0)
return now;
- total += now;
size -= now;
buf += now;
}
- return insize;
+ return insize - size;
}
EXPORT_SYMBOL(read_full);