pkcs11-tool: handle non-recognized tokens gracefully.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4803 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2010-10-08 08:36:56 +00:00
parent fad0116fef
commit 364ba4882d
1 changed files with 7 additions and 3 deletions

View File

@ -802,9 +802,13 @@ static void list_slots(int tokens, int refresh, int print)
static void show_token(CK_SLOT_ID slot)
{
CK_TOKEN_INFO info;
get_token_info(slot, &info);
CK_RV rv;
rv = p11->C_GetTokenInfo(slot, &info);
if (rv == CKR_TOKEN_NOT_RECOGNIZED) {
printf(" (token not recognized)\n");
return;
}
if (!(info.flags & CKF_TOKEN_INITIALIZED) && (!verbose)) {
printf(" token state: uninitialized\n");
return;