Mercurial > hg > toybox
changeset 309:79a61cd58596
Bug spotted by Roberto Foglietta: at EOF readall() should return count, not len.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 18 Jul 2008 04:15:59 -0500 |
parents | 52600eee8dd6 |
children | 8b8116214b1c |
files | lib/lib.c |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/lib.c Thu Jul 03 19:19:00 2008 -0500 +++ b/lib/lib.c Fri Jul 18 04:15:59 2008 -0500 @@ -219,9 +219,10 @@ 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; }