From 2654ce29dcda57177796643640d07d595a57c012 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 17 Jul 2012 08:09:16 +0200 Subject: [PATCH] Initialize mutexes correctly in mock module https://bugzilla.gnome.org/show_bug.cgi?id=44740 --- tests/mock-module-ep.c | 1 + tests/mock-module.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/mock-module-ep.c b/tests/mock-module-ep.c index c784546..7440a74 100644 --- a/tests/mock-module-ep.c +++ b/tests/mock-module-ep.c @@ -44,6 +44,7 @@ __declspec(dllexport) CK_RV C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list) { + mock_module_init (); if (list == NULL) return CKR_ARGUMENTS_BAD; *list = &mock_module_no_slots; diff --git a/tests/mock-module.c b/tests/mock-module.c index 36515d0..99cde50 100644 --- a/tests/mock-module.c +++ b/tests/mock-module.c @@ -890,5 +890,9 @@ CK_FUNCTION_LIST mock_module_no_slots = { void mock_module_init (void) { - _p11_mutex_init (&init_mutex); + static int initialized = 0; + if (!initialized) { + _p11_mutex_init (&init_mutex); + initialized = 1; + } } -- 1.7.10.4