Skip to content

Commit

Permalink
verify_pack: do not ignore return value of verification function
Browse files Browse the repository at this point in the history
In verify_pack, a caller-supplied verification function is called.
The function returns an int.  If that return value is non-zero,
verify_pack should fail.

The only caller of verify_pack is in builtin/fsck.c, whose verify_fn
returns a meaningful error code (which was then ignored).  Now, fsck
might return a different error code (with more detail).  This would
happen in the unlikely event that a commit or tree that is a valid git
object but not a valid instance of its type gets into a pack.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Jeff King <peff@peff.net>
  • Loading branch information
dturner-tw authored and peff committed Dec 1, 2015
1 parent 908a6e4 commit 8c24d83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pack-check.c
Expand Up @@ -126,7 +126,7 @@ static int verify_packfile(struct packed_git *p,
sha1_to_hex(entries[i].sha1), p->pack_name);
else if (fn) {
int eaten = 0;
fn(entries[i].sha1, type, size, data, &eaten);
err |= fn(entries[i].sha1, type, size, data, &eaten);
if (eaten)
data = NULL;
}
Expand Down

0 comments on commit 8c24d83

Please sign in to comment.