fixed some thread dead-lock bugs

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@930 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
sth 2003-02-23 19:38:50 +00:00
parent 9173c9934e
commit 49760f9cfb
1 changed files with 13 additions and 7 deletions

View File

@ -72,8 +72,10 @@ CK_RV C_Finalize(CK_VOID_PTR pReserved)
if (rv != CKR_OK)
return rv;
if (pReserved != NULL)
return CKR_ARGUMENTS_BAD;
if (pReserved != NULL) {
rv = CKR_ARGUMENTS_BAD;
goto out;
}
debug(context, "Shutting down Cryptoki\n");
for (i=0; i<context->reader_count; i++)
@ -81,7 +83,7 @@ CK_RV C_Finalize(CK_VOID_PTR pReserved)
sc_release_context(context);
context = NULL;
sc_pkcs11_unlock();
out: sc_pkcs11_unlock();
sc_pkcs11_free_lock();
return CKR_OK;
@ -199,8 +201,10 @@ CK_RV C_GetSlotInfo(CK_SLOT_ID slotID, CK_SLOT_INFO_PTR pInfo)
rv = slot_get_slot(slotID, &slot);
if (rv == CKR_OK)
rv = card_detect(slot->reader);
if (rv == CKR_TOKEN_NOT_PRESENT)
return CKR_OK;
if (rv == CKR_TOKEN_NOT_PRESENT) {
rv = CKR_OK;
goto out;
}
if (rv == CKR_OK)
memcpy(pInfo, &slot->slot_info, sizeof(CK_SLOT_INFO));
@ -302,8 +306,10 @@ CK_RV C_InitToken(CK_SLOT_ID slotID,
}
}
if (slot->card->framework->init_token == NULL)
return CKR_FUNCTION_NOT_SUPPORTED;
if (slot->card->framework->init_token == NULL) {
rv = CKR_FUNCTION_NOT_SUPPORTED;
goto out;
}
rv = slot->card->framework->init_token(slot->card,
slot->fw_data, pPin, ulPinLen, pLabel);