X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=mktag.c;h=931011121e7276513b55fc41691c65a0d924119d;hb=738a1154db190c75a7454da85d85be68ad7db065;hp=09b6e437d46a71b0123b5cb791cc537cf946e7a1;hpb=579d1fbfaf25550254014fa472faac95f88eb779;p=git.git diff --git a/mktag.c b/mktag.c index 09b6e437d..931011121 100644 --- a/mktag.c +++ b/mktag.c @@ -27,13 +27,13 @@ static int verify_object(unsigned char *sha1, const char *expected_type) { int ret = -1; - char type[100]; + enum object_type type; unsigned long size; - void *buffer = read_sha1_file(sha1, type, &size); + void *buffer = read_sha1_file(sha1, &type, &size); if (buffer) { - if (!strcmp(type, expected_type)) - ret = check_sha1_signature(sha1, buffer, size, type); + if (type == type_from_string(expected_type)) + ret = check_sha1_signature(sha1, buffer, size, expected_type); free(buffer); } return ret; @@ -119,11 +119,11 @@ static int verify_tag(char *buffer, unsigned long size) int main(int argc, char **argv) { unsigned long size = 4096; - char *buffer = malloc(size); + char *buffer = xmalloc(size); unsigned char result_sha1[20]; if (argc != 1) - usage("cat | git-mktag"); + usage("git-mktag < signaturefile"); setup_git_directory();