From 3e82c6182d913a3fd5cf904342a9a6fa44aef0d6 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 18 Sep 2012 14:01:54 +0200 Subject: [PATCH] Don't fail initialization if last initialized module fails * We weren't resetting the result code after a failure, so even though failures for critical modules didn't interrupt the initialization loop, the result still leaked to callers. * Also print an error message clearly indicating that a module failed to initialize, regardless of whether critical or not. https://bugs.freedesktop.org/show_bug.cgi?id=55051 --- p11-kit/modules.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/p11-kit/modules.c b/p11-kit/modules.c index 547ee02..9dc3a3a 100644 --- a/p11-kit/modules.c +++ b/p11-kit/modules.c @@ -733,11 +733,13 @@ _p11_kit_initialize_registered_unlocked_reentrant (void) * then this, should abort loading of others. */ if (rv != CKR_OK) { + _p11_message ("failed to initialize module: %s: %s", + mod->name, p11_kit_strerror (rv)); + critical = _p11_conf_parse_boolean (_p11_hash_get (mod->config, "critical"), 0); - if (critical) { - _p11_debug ("failed to initialize module: %s: %s", - mod->name, p11_kit_strerror (rv)); - break; + if (!critical) { + _p11_debug ("ignoring failure, non-critical module: %s", mod->name); + rv = CKR_OK; } } } -- 1.7.12