Skip to content

Commit 8c24d83

Browse files
dturner-twpeff
authored andcommitted
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 <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 908a6e4 commit 8c24d83

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pack-check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static int verify_packfile(struct packed_git *p,
126126
sha1_to_hex(entries[i].sha1), p->pack_name);
127127
else if (fn) {
128128
int eaten = 0;
129-
fn(entries[i].sha1, type, size, data, &eaten);
129+
err |= fn(entries[i].sha1, type, size, data, &eaten);
130130
if (eaten)
131131
data = NULL;
132132
}

0 commit comments

Comments
 (0)