aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 8467f866..959cd46c 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -219,9 +219,10 @@ FILE *xfopen(char *path, char *mode)
ssize_t readall(int fd, void *buf, size_t len)
{
size_t count = 0;
+
while (count<len) {
int i = read(fd, buf+count, len-count);
- if (!i) return len;
+ if (!i) break;
if (i<0) return i;
count += i;
}