From 0ea11523a3b6a90a9c3ee380218baaa9ef7faa5f Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 31 Oct 2019 15:37:45 +0100 Subject: [PATCH] Improve logging of exit codes --- src/pkcs11/framework-pkcs15.c | 2 +- src/pkcs11/pkcs11-global.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pkcs11/framework-pkcs15.c b/src/pkcs11/framework-pkcs15.c index 527c1b14..22081ffe 100644 --- a/src/pkcs11/framework-pkcs15.c +++ b/src/pkcs11/framework-pkcs15.c @@ -591,7 +591,7 @@ CK_RV C_GetTokenInfo(CK_SLOT_ID slotID, CK_TOKEN_INFO_PTR pInfo) memcpy(pInfo, &slot->token_info, sizeof(CK_TOKEN_INFO)); out: sc_pkcs11_unlock(); - sc_log(context, "C_GetTokenInfo(%lx) returns 0x%lX", slotID, rv); + sc_log(context, "C_GetTokenInfo(%lx) returns %s", slotID, lookup_enum(RV_T, rv)); return rv; } diff --git a/src/pkcs11/pkcs11-global.c b/src/pkcs11/pkcs11-global.c index d8c0df5f..71e13831 100644 --- a/src/pkcs11/pkcs11-global.c +++ b/src/pkcs11/pkcs11-global.c @@ -584,12 +584,11 @@ CK_RV C_GetSlotInfo(CK_SLOT_ID slotID, CK_SLOT_INFO_PTR pInfo) } rv = slot_get_slot(slotID, &slot); - sc_log(context, "C_GetSlotInfo() get slot rv %lu", rv); - if (rv == CKR_OK) { - if (slot->reader == NULL) { + sc_log(context, "C_GetSlotInfo() get slot rv %s", lookup_enum( RV_T, rv)); + if (rv == CKR_OK) { + if (slot->reader == NULL) { rv = CKR_TOKEN_NOT_PRESENT; - } - else { + } else { now = get_current_time(); if (now >= slot->slot_state_expires || now == 0) { /* Update slot status */