From: Shawn O. Pearce Date: Wed, 28 Feb 2007 16:32:56 GMT Subject: Re: Error "fatal: cannot pread pack file: Success" Message-ID: <20070228163256.GD5479@spearce.org> In-Reply-To: <17893.44181.129918.669187@lisa.zopyra.com> Bill Lear wrote: > >The code has this: > > > > unsigned long from = obj[0].offset + obj[0].hdr_size; > > unsigned long len = obj[1].offset - from; > > > >by "offset", do you want obj[0].offset and obj[1].offset? > > > >How do I get the size of the packfile? Is it obj->size? I meant something like this: diff --git a/index-pack.c b/index-pack.c index cf81a99..001aa46 100644 --- a/index-pack.c +++ b/index-pack.c @@ -287,7 +287,7 @@ static void *get_data_from_pack(struct object_entry *obj) do { ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy); if (n <= 0) - die("cannot pread pack file: %s", strerror(errno)); + die("cannot pread pack file: %s from=%lu, packfile size=%lu", strerror(errno), from, lseek(pack_fd, SEEK_END, 0)); rdy += n; } while (rdy < len); data = xmalloc(obj->size); -- Shawn.