sc_pkcs11_close_all_sessions: close all sessions even if closing one fails

This commit is contained in:
Frank Morgner 2015-04-20 16:18:11 +02:00
parent 17eb40e5f9
commit c45c90a337
1 changed files with 4 additions and 4 deletions

View File

@ -120,17 +120,17 @@ static CK_RV sc_pkcs11_close_session(CK_SESSION_HANDLE hSession)
* the global lock held */ * the global lock held */
CK_RV sc_pkcs11_close_all_sessions(CK_SLOT_ID slotID) CK_RV sc_pkcs11_close_all_sessions(CK_SLOT_ID slotID)
{ {
CK_RV rv = CKR_OK; CK_RV rv = CKR_OK, error;
struct sc_pkcs11_session *session; struct sc_pkcs11_session *session;
unsigned int i; unsigned int i;
sc_log(context, "real C_CloseAllSessions(0x%lx) %d", slotID, list_size(&sessions)); sc_log(context, "real C_CloseAllSessions(0x%lx) %d", slotID, list_size(&sessions));
for (i = 0; i < list_size(&sessions); i++) { for (i = 0; i < list_size(&sessions); i++) {
session = list_get_at(&sessions, i); session = list_get_at(&sessions, i);
if (session->slot->id == slotID) if (session->slot->id == slotID)
if ((rv = sc_pkcs11_close_session(session->handle)) != CKR_OK) if ((error = sc_pkcs11_close_session(session->handle)) != CKR_OK)
return rv; rv = error;
} }
return CKR_OK; return rv;
} }
CK_RV C_CloseSession(CK_SESSION_HANDLE hSession) CK_RV C_CloseSession(CK_SESSION_HANDLE hSession)