sbverify: Use a variable for image filename

... rather than using argv[optind] multiple times.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
Jeremy Kerr 2012-06-14 10:32:50 +08:00
parent 376974e386
commit 71f6b9b5cb

View file

@ -180,7 +180,7 @@ static int x509_verify_cb(int status, X509_STORE_CTX *ctx)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
const char *detached_sig_filename; const char *detached_sig_filename, *image_filename;
enum verify_status status; enum verify_status status;
int rc, c, flags, verify; int rc, c, flags, verify;
const uint8_t *tmp_buf; const uint8_t *tmp_buf;
@ -233,9 +233,11 @@ int main(int argc, char **argv)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
image = image_load(argv[optind]); image_filename = argv[optind];
image = image_load(image_filename);
if (!image) { if (!image) {
fprintf(stderr, "Can't open image %s\n", argv[optind]); fprintf(stderr, "Can't open image %s\n", image_filename);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -249,7 +251,7 @@ int main(int argc, char **argv)
if (rc) { if (rc) {
fprintf(stderr, "Unable to read signature data from %s\n", fprintf(stderr, "Unable to read signature data from %s\n",
detached_sig_filename ? : argv[optind]); detached_sig_filename ? : image_filename);
goto out; goto out;
} }