]> granicus.if.org Git - p11-kit/commitdiff
p11-kit: Tweak last commit, handle the not-forked case
authorStef Walter <stef@thewalter.net>
Thu, 7 Aug 2014 06:37:50 +0000 (08:37 +0200)
committerStef Walter <stef@thewalter.net>
Thu, 7 Aug 2014 06:37:50 +0000 (08:37 +0200)
When we hadn't forked, but were just not initialized, still return
CKR_CRYPTOKI_NOT_INITIALIZED from managed modules.

p11-kit/modules.c

index 293ea4d16742d60529ace7171be6cd1f9becb22e..9eaff40753351f394a31e54717ff5f4f1cd910f6 100644 (file)
@@ -1590,7 +1590,10 @@ managed_C_Finalize (CK_X_FUNCTION_LIST *self,
        p11_lock ();
 
        pid = getpid ();
-       if (managed->initialized != pid) {
+       if (managed->initialized == 0) {
+               rv = CKR_CRYPTOKI_NOT_INITIALIZED;
+
+       } else if (managed->initialized != pid) {
                /*
                 * In theory we should be returning CKR_CRYPTOKI_NOT_INITIALIZED here
                 * but enough callers are not completely aware of their forking.