From: Aki Tuomi Date: Sun, 29 Mar 2015 15:55:13 +0000 (+0300) Subject: Show error code if C_GetSlotInfo fails X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~98^2~33^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=989c2e30e46903a4d4e2d62474422a5216b0061f;p=thirdparty%2Fpdns.git Show error code if C_GetSlotInfo fails --- diff --git a/pdns/pkcs11signers.cc b/pdns/pkcs11signers.cc index 42786dfe58..52bc44616f 100644 --- a/pdns/pkcs11signers.cc +++ b/pdns/pkcs11signers.cc @@ -620,7 +620,7 @@ boost::shared_ptr Pkcs11Token::GetToken(const std::string& module, tidx.append(label); std::map >::iterator tokenIter; std::map >::iterator slotIter; - + CK_RV err; CK_FUNCTION_LIST* functions; if ((tokenIter = pkcs11_tokens.find(tidx)) != pkcs11_tokens.end()) return tokenIter->second; @@ -641,8 +641,10 @@ boost::shared_ptr Pkcs11Token::GetToken(const std::string& module, // try to locate a slot _CK_SLOT_INFO info; - if (functions->C_GetSlotInfo(slotId, &info)) { - throw PDNSException(std::string("Cannot find PKCS#11 slot ") + boost::lexical_cast(slotId) + std::string(" on module ") + module); + unsigned long slots; + + if ((err = functions->C_GetSlotInfo(slotId, &info))) { + throw PDNSException(std::string("Cannot find PKCS#11 slot ") + boost::lexical_cast(slotId) + std::string(" on module ") + module + std::string(": error code ") + boost::lexical_cast(err)); } // store slot