Merge branch 'jk/read-in-full-stops-on-error'

* jk/read-in-full-stops-on-error:
  read_in_full: always report errors
This commit is contained in:
Junio C Hamano
2011-05-31 12:08:55 -07:00

View File

@ -148,8 +148,10 @@ ssize_t read_in_full(int fd, void *buf, size_t count)
while (count > 0) { while (count > 0) {
ssize_t loaded = xread(fd, p, count); ssize_t loaded = xread(fd, p, count);
if (loaded <= 0) if (loaded < 0)
return total ? total : loaded; return -1;
if (loaded == 0)
return total;
count -= loaded; count -= loaded;
p += loaded; p += loaded;
total += loaded; total += loaded;