diff options
-rw-r--r-- | lib/lib.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; } |