diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-20 01:10:46 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-20 01:10:46 -0700 |
commit | d98b46f8d9a3daf965a39f8c0089c1401e0081ee (patch) | |
tree | 765ea3ef9d7d57d29a38d4c1d1ddc4be17554936 /fsck-cache.c | |
parent | cb126d8d7906b3c15f313ca479259e567042840a (diff) | |
download | git-d98b46f8d9a3daf965a39f8c0089c1401e0081ee.tar.gz git-d98b46f8d9a3daf965a39f8c0089c1401e0081ee.tar.xz |
Do SHA1 hash _before_ compression.
And add a "convert-cache" program to convert from old-style
to new-style.
Diffstat (limited to 'fsck-cache.c')
-rw-r--r-- | fsck-cache.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fsck-cache.c b/fsck-cache.c index 952d41387..96b8eb161 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; } } |