verify_pack: do not ignore return value of verification function

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>

David Turner committed Nov 30, 2015 at 17:47 UTC 8c24d832cdcc1602fb5c7e7295447f8043879bf7
1 file changed +1 -1
pack-check.c
+1 -1
@@ -126,7 +126,7 @@ static int verify_packfile(struct packed_git *p,
126 sha1_to_hex(entries[i].sha1), p->pack_name);
127 else if (fn) {
128 int eaten = 0;
129 - fn(entries[i].sha1, type, size, data, &eaten);
129 + err |= fn(entries[i].sha1, type, size, data, &eaten);
130 if (eaten)
131 data = NULL;
132 }