sc-hsm-tool: Fixed SEGV if no or invalid card in reader

This commit is contained in:
Andreas Schwier 2014-06-06 21:10:28 +02:00 committed by Viktor Tarasov
parent b1b5a39ffa
commit 072dfeb71c
1 changed files with 4 additions and 2 deletions

View File

@ -1502,8 +1502,10 @@ int main(int argc, char * const argv[])
}
err = util_connect_card(ctx, &card, opt_reader, opt_wait, verbose);
if (r != SC_SUCCESS) {
fprintf(stderr, "Failed to connect to card: %s\n", sc_strerror(r));
if (err != SC_SUCCESS) {
if (err < 0) {
fprintf(stderr, "Failed to connect to card: %s\n", sc_strerror(err));
}
goto end;
}