diff options
Diffstat (limited to 'builtin-verify-tag.c')
-rw-r--r-- | builtin-verify-tag.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/builtin-verify-tag.c b/builtin-verify-tag.c index cc4c55d7e..729a1593e 100644 --- a/builtin-verify-tag.c +++ b/builtin-verify-tag.c @@ -12,7 +12,7 @@ #include <signal.h> static const char builtin_verify_tag_usage[] = - "git-verify-tag [-v|--verbose] <tag>..."; + "git verify-tag [-v|--verbose] <tag>..."; #define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----" @@ -45,14 +45,14 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose) memset(&gpg, 0, sizeof(gpg)); gpg.argv = args_gpg; gpg.in = -1; - gpg.out = 1; args_gpg[2] = path; - if (start_command(&gpg)) + if (start_command(&gpg)) { + unlink(path); return error("could not run gpg."); + } write_in_full(gpg.in, buf, len); close(gpg.in); - gpg.close_in = 0; ret = finish_command(&gpg); unlink(path); @@ -90,16 +90,17 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; - git_config(git_default_config); - - if (argc == 1) - usage(builtin_verify_tag_usage); + git_config(git_default_config, NULL); - if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) { + if (argc > 1 && + (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose"))) { verbose = 1; i++; } + if (argc <= i) + usage(builtin_verify_tag_usage); + /* sometimes the program was terminated because this signal * was received in the process of writing the gpg input: */ signal(SIGPIPE, SIG_IGN); |