X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=fsck-cache.c;h=96b8eb161107cd3219975d93a44874a5455b702e;hb=65bc81d6fef619d7aadc5c7116be52860539f17a;hp=952d41387ac279bcc35fbe5e40fb7d3d917894ea;hpb=f43b8abc6f051aece327a3779e903106916d6e67;p=git.git diff --git a/fsck-cache.c b/fsck-cache.c index 952d4138..96b8eb16 100644 --- a/fsck-cache.c +++ b/fsck-cache.c @@ -85,12 +85,13 @@ static int fsck_name(char *hex) if (map) { char type[100]; unsigned long size; - void *buffer = NULL; - if (!check_sha1_signature(sha1, map, mapsize)) - buffer = unpack_sha1_file(map, mapsize, type, - &size); + void *buffer = unpack_sha1_file(map, mapsize, type, &size); + if (!buffer) + return -1; + if (check_sha1_signature(sha1, buffer, size, type) < 0) + printf("sha1 mismatch %s\n", sha1_to_hex(sha1)); munmap(map, mapsize); - if (buffer && !fsck_entry(sha1, type, buffer, size)) + if (!fsck_entry(sha1, type, buffer, size)) return 0; } }