From 0b78f800ea0dc0dba420293c32bbd5e95231eba1 Mon Sep 17 00:00:00 2001 From: "nelsonb%netscape.com" Date: Wed, 21 Nov 2001 20:52:37 +0000 Subject: [PATCH] Change the behavior of the -list option so that it doesn't stop at the first error it encounters when looping through the slots, and so that it displays the slot info even if it cannot get token info. 111075 git-svn-id: svn://10.0.0.236/trunk@108719 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/nss/cmd/modutil/pk11.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/mozilla/security/nss/cmd/modutil/pk11.c b/mozilla/security/nss/cmd/modutil/pk11.c index 20838e6a08b..d20807b06e8 100644 --- a/mozilla/security/nss/cmd/modutil/pk11.c +++ b/mozilla/security/nss/cmd/modutil/pk11.c @@ -437,6 +437,7 @@ ListModule(char *moduleName) CK_TOKEN_INFO tokeninfo; char *ciphers, *mechanisms; PK11DisableReasons reason; + Error rv = SUCCESS; if(!moduleName) { return SUCCESS; @@ -495,12 +496,8 @@ ListModule(char *moduleName) if(PK11_GetSlotInfo(slot, &slotinfo) != SECSuccess) { PR_fprintf(PR_STDERR, errStrings[SLOT_INFO_ERR], PK11_GetSlotName(slot)); - return SLOT_INFO_ERR; - } - if(PK11_GetTokenInfo(slot, &tokeninfo) != SECSuccess) { - PR_fprintf(PR_STDERR, errStrings[TOKEN_INFO_ERR], - slot->token_name); - return TOKEN_INFO_ERR; + rv = SLOT_INFO_ERR; + continue; } /* Slot Info */ @@ -534,6 +531,13 @@ ListModule(char *moduleName) PR_fprintf(PR_STDOUT, PAD"Status: Enabled\n"); } + if(PK11_GetTokenInfo(slot, &tokeninfo) != SECSuccess) { + PR_fprintf(PR_STDERR, errStrings[TOKEN_INFO_ERR], + slot->token_name); + rv = TOKEN_INFO_ERR; + continue; + } + /* Token Info */ PR_fprintf(PR_STDOUT, PAD"Token Name: %.32s\n", tokeninfo.label); @@ -565,7 +569,7 @@ ListModule(char *moduleName) } PR_fprintf(PR_STDOUT, "\n-----------------------------------------------------------\n"); - return SUCCESS; + return rv; } /************************************************************************