summaryrefslogtreecommitdiff
path: root/wrapper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-31 19:08:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-05-31 19:08:55 (GMT)
commit27c67292019e8d49c5b5e3ce73c59c03c08b2ada (patch)
tree5a7cb36545a5a6a04fe3776ce61c13eaa133f1b0 /wrapper.c
parent2cd517cdd3f52bcfb5a87e6991560cc000b11089 (diff)
parent56d7c27af1f8aa7519f165f6c022732e64db3716 (diff)
downloadgit-27c67292019e8d49c5b5e3ce73c59c03c08b2ada.zip
git-27c67292019e8d49c5b5e3ce73c59c03c08b2ada.tar.gz
git-27c67292019e8d49c5b5e3ce73c59c03c08b2ada.tar.bz2
Merge branch 'jk/read-in-full-stops-on-error'
* jk/read-in-full-stops-on-error: read_in_full: always report errors
Diffstat (limited to 'wrapper.c')
-rw-r--r--wrapper.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/wrapper.c b/wrapper.c
index 2829000..85f09df 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -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;