summaryrefslogtreecommitdiff
path: root/index-pack.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-10-08 15:05:43 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2008-10-08 15:05:43 (GMT)
commitc4f6a48969b33e7fec8fce592e38a60849782d2a (patch)
treeb80cf97c8a44782c982a7aa1181f2da3f602aaf3 /index-pack.c
parent19d4b416f429ac2d3f4c225aaf1af8761bcb03dd (diff)
parentfb7424363643d6049faf3bda399e5e602782b5b7 (diff)
downloadgit-c4f6a48969b33e7fec8fce592e38a60849782d2a.zip
git-c4f6a48969b33e7fec8fce592e38a60849782d2a.tar.gz
git-c4f6a48969b33e7fec8fce592e38a60849782d2a.tar.bz2
Merge branch 'maint'
* maint: Do not use errno when pread() returns 0 git init: --bare/--shared overrides system/global config git-push.txt: Describe --repo option in more detail git rm: refresh index before up-to-date check Fix a few typos in relnotes
Diffstat (limited to 'index-pack.c')
-rw-r--r--index-pack.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/index-pack.c b/index-pack.c
index 2e4c088..73860bf 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -365,8 +365,11 @@ static void *get_data_from_pack(struct object_entry *obj)
data = src;
do {
ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);
- if (n <= 0)
+ if (n < 0)
die("cannot pread pack file: %s", strerror(errno));
+ if (!n)
+ die("premature end of pack file, %lu bytes missing",
+ len - rdy);
rdy += n;
} while (rdy < len);
data = xmalloc(obj->size);