From f0a6a568f4aad5529bca0cfdf580744fb46f423f Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Thu, 25 Apr 2019 16:23:53 +0200 Subject: [PATCH] fixed Local variable hides global variable --- src/tools/openpgp-tool.c | 10 +++++----- src/tools/opensc-tool.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/tools/openpgp-tool.c b/src/tools/openpgp-tool.c index dcff9f8c..c48d87e7 100644 --- a/src/tools/openpgp-tool.c +++ b/src/tools/openpgp-tool.c @@ -98,7 +98,7 @@ static int opt_keyinfo = 0; static char *exec_program = NULL; static int opt_genkey = 0; static u8 key_id = 0; -static char *keytype = NULL; +static char *opt_keytype = NULL; static int opt_verify = 0; static char *verifytype = NULL; static int opt_pin = 0; @@ -506,9 +506,9 @@ static int decode_options(int argc, char **argv) actions++; break; case 't': - if (keytype) - free(keytype); - keytype = strdup(optarg); + if (opt_keytype) + free(opt_keytype); + opt_keytype = strdup(optarg); break; case 'h': util_print_usage_and_die(app_name, options, option_help, NULL); @@ -922,7 +922,7 @@ int main(int argc, char **argv) } if (opt_genkey) - exit_status |= do_genkey(card, key_id, keytype); + exit_status |= do_genkey(card, key_id, opt_keytype); if (exec_program) { char *const largv[] = {exec_program, NULL}; diff --git a/src/tools/opensc-tool.c b/src/tools/opensc-tool.c index 4b309e14..b5f57801 100644 --- a/src/tools/opensc-tool.c +++ b/src/tools/opensc-tool.c @@ -280,7 +280,7 @@ static int list_readers(void) reader->capabilities & SC_READER_CAP_PIN_PAD ? "PIN pad":"", reader->name); if (state & SC_READER_CARD_PRESENT && verbose) { - struct sc_card *card; + struct sc_card *c; int r; char tmp[SC_MAX_ATR_SIZE*3]; sc_bin_to_hex(reader->atr.value, reader->atr.len, tmp, sizeof(tmp) - 1, ':'); @@ -288,11 +288,11 @@ static int list_readers(void) if (state & SC_READER_CARD_EXCLUSIVE) printf(" %s [EXCLUSIVE]\n", tmp); else { - if ((r = sc_connect_card(reader, &card)) != SC_SUCCESS) { + if ((r = sc_connect_card(reader, &c)) != SC_SUCCESS) { fprintf(stderr, " failed: %s\n", sc_strerror(r)); } else { - printf(" %s %s %s\n", tmp, card->name ? card->name : "", state & SC_READER_CARD_INUSE ? "[IN USE]" : ""); - sc_disconnect_card(card); + printf(" %s %s %s\n", tmp, c->name ? c->name : "", state & SC_READER_CARD_INUSE ? "[IN USE]" : ""); + sc_disconnect_card(c); } } }