Skip to content

Commit

Permalink
Merge branch 'jk/read-in-full-stops-on-error'
Browse files Browse the repository at this point in the history
* jk/read-in-full-stops-on-error:
  read_in_full: always report errors
  • Loading branch information
Junio C Hamano committed May 31, 2011
2 parents 2cd517c + 56d7c27 commit 27c6729
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ ssize_t read_in_full(int fd, void *buf, size_t count)

while (count > 0) {
ssize_t loaded = xread(fd, p, count);
if (loaded <= 0)
return total ? total : loaded;
if (loaded < 0)
return -1;
if (loaded == 0)
return total;
count -= loaded;
p += loaded;
total += loaded;
Expand Down

0 comments on commit 27c6729

Please sign in to comment.