pkcs15init: fix #96: more details for the load profiles error

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4261 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
viktor.tarasov 2010-04-20 17:09:26 +00:00
parent 34841669a2
commit 8f4ee1b6e4
1 changed files with 21 additions and 4 deletions

View File

@ -345,10 +345,27 @@ sc_pkcs15init_bind(struct sc_card *card, const char *name,
strlcpy(card_profile, profile_option, sizeof(card_profile));
}
if ((r = sc_profile_load(profile, profile->name)) < 0
|| (r = sc_profile_load(profile, card_profile)) < 0
|| (r = sc_profile_finish(profile)) < 0) {
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Failed to load profile: %s\n", sc_strerror(r));
do {
r = sc_profile_load(profile, profile->name);
if (r < 0) {
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Failed to load profile '%s': %s\n",
profile->name, sc_strerror(r));
break;
}
r = sc_profile_load(profile, card_profile);
if (r < 0) {
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Failed to load profile '%s': %s\n",
card_profile, sc_strerror(r));
break;
}
r = sc_profile_finish(profile);
if (r < 0)
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Failed to finalize profile: %s\n", sc_strerror(r));
} while (0);
if (r < 0) {
sc_profile_free(profile);
SC_TEST_RET(ctx, SC_LOG_DEBUG_NORMAL, r, "Load profile error");
}