summaryrefslogtreecommitdiff
path: root/module/p11-kit-proxy.c
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-01-24 21:41:55 -0600
committerStef Walter <stefw@collabora.co.uk>2011-01-24 21:41:55 -0600
commitf8009b4d504de0ed752b867893acd263108409e0 (patch)
tree106d3f60a7a6cb45f6e3ed21a4f11ec3c40034d2 /module/p11-kit-proxy.c
parentb2b0acbc5789823a33de9eabec10e2b8656f3632 (diff)
Reinitialize modules after fork().
Diffstat (limited to 'module/p11-kit-proxy.c')
-rw-r--r--module/p11-kit-proxy.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/module/p11-kit-proxy.c b/module/p11-kit-proxy.c
index b02722b..02f8ac3 100644
--- a/module/p11-kit-proxy.c
+++ b/module/p11-kit-proxy.c
@@ -191,6 +191,24 @@ finalize_mappings_unlocked (void)
gl.sessions = NULL;
}
+void
+_p11_kit_proxy_after_fork (void)
+{
+ /*
+ * After a fork the callers are supposed to call C_Initialize and all.
+ * In addition the underlying libraries may change their state so free
+ * up any mappings and all
+ */
+
+ _p11_lock ();
+
+ gl.mappings_refs = 1;
+ finalize_mappings_unlocked ();
+ assert (!gl.mappings);
+
+ _p11_unlock ();
+}
+
static CK_RV
proxy_C_Finalize (CK_VOID_PTR reserved)
{