fixed Local variable hides global variable

This commit is contained in:
Frank Morgner 2019-04-25 16:23:53 +02:00
parent 0bc95cb6a1
commit f0a6a568f4
2 changed files with 9 additions and 9 deletions

View File

@ -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};

View File

@ -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);
}
}
}