summaryrefslogtreecommitdiff
path: root/index-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-02-27 22:15:42 -0800
committerJunio C Hamano <junkio@cox.net>2007-02-27 22:15:42 -0800
commitc4f8f827555dcbbee148fd1daa4821533ead2ea2 (patch)
tree6fe27e7692192451906b072f71ce65909b8fd5e4 /index-pack.c
parent8538e876b191901b7d37ec34a83287e51df91816 (diff)
parent163d7b9b8536d206eda7eb0eccb0fc211812346f (diff)
downloadgit-c4f8f827555dcbbee148fd1daa4821533ead2ea2.tar.gz
Merge branch 'maint'
* maint: builtin-fmt-merge-msg: fix bugs in --file option index-pack: Loop over pread until data loading is complete. blameview: Fix the browse behavior in blameview Fix minor typos/grammar in user-manual.txt Correct ordering in git-cvsimport's option documentation git-show: Reject native ref Fix git-show man page formatting in the EXAMPLES section
Diffstat (limited to 'index-pack.c')
-rw-r--r--index-pack.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/index-pack.c b/index-pack.c
index fa9a0e7489..48874a052a 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -277,13 +277,19 @@ static void *get_data_from_pack(struct object_entry *obj)
{
unsigned long from = obj[0].offset + obj[0].hdr_size;
unsigned long len = obj[1].offset - from;
+ unsigned long rdy = 0;
unsigned char *src, *data;
z_stream stream;
int st;
src = xmalloc(len);
- if (pread(pack_fd, src, len, from) != len)
- die("cannot pread pack file: %s", strerror(errno));
+ data = src;
+ do {
+ ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);
+ if (n <= 0)
+ die("cannot pread pack file: %s", strerror(errno));
+ rdy += n;
+ } while (rdy < len);
data = xmalloc(obj->size);
memset(&stream, 0, sizeof(stream));
stream.next_out = data;