summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2012-07-17 08:09:16 +0200
committerStef Walter <stefw@gnome.org>2012-07-26 12:22:31 +0200
commitc6fc7b3ac4c6d4595f17989cff220d6d6dafe620 (patch)
tree413a793a152002f41f748b88a322fda5de26c8da
parent1f428d62a13e481aa51d1fcee0c4652dc9ef7a72 (diff)
downloadp11-kit-c6fc7b3ac4c6d4595f17989cff220d6d6dafe620.tar.gz
Initialize mutexes correctly in mock module
https://bugzilla.gnome.org/show_bug.cgi?id=44740
-rw-r--r--tests/mock-module-ep.c1
-rw-r--r--tests/mock-module.c6
2 files changed, 6 insertions, 1 deletions
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;
+ }
}