qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org, rrelyea@redhat.com
Subject: [Qemu-devel] [PATCH 2/3] libcacard/vcard_emul_nss: handle no readers at startup
Date: Thu, 22 Mar 2012 20:20:58 +0200	[thread overview]
Message-ID: <1332440459-17518-3-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1332440459-17518-1-git-send-email-alevy@redhat.com>

When starting with no readers, coolkey should show no slots (with
RHBZ 806038 fixed). Fix initialization to launch the event handling
thread for each module that isn't the internal module regardless of the
number of slots detected for it at initialization time, since slot
number may start as 0 and is dynamic.

RHBZ: 802435
Signed-off-by: Alon Levy <alevy@redhat.com>
---
 libcacard/vcard_emul_nss.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index 7de5d5b..3703fdc 100644
--- a/libcacard/vcard_emul_nss.c
+++ b/libcacard/vcard_emul_nss.c
@@ -1005,10 +1005,10 @@ vcard_emul_init(const VCardEmulOptions *options)
     SECMOD_GetReadLock(module_lock);
     for (mlp = module_list; mlp; mlp = mlp->next) {
         SECMODModule *module = mlp->module;
-        PRBool has_emul_slots = PR_FALSE;
 
-        if (module == NULL) {
-                continue;
+        /* Ignore the internal module */
+        if (module == NULL || module == SECMOD_GetInternalModule()) {
+            continue;
         }
 
         for (i = 0; i < module->slotCount; i++) {
@@ -1024,9 +1024,6 @@ vcard_emul_init(const VCardEmulOptions *options)
                                   vreader_emul_delete);
             vreader_add_reader(vreader);
 
-            has_readers = PR_TRUE;
-            has_emul_slots = PR_TRUE;
-
             if (PK11_IsPresent(slot)) {
                 VCard *vcard;
                 vcard = vcard_emul_mirror_card(vreader);
@@ -1035,12 +1032,10 @@ vcard_emul_init(const VCardEmulOptions *options)
                 vcard_free(vcard);
             }
         }
-        if (has_emul_slots) {
-            vcard_emul_new_event_thread(module);
-        }
+        vcard_emul_new_event_thread(module);
     }
     SECMOD_ReleaseReadLock(module_lock);
-    nss_emul_init = has_readers;
+    nss_emul_init = PR_TRUE;
 
     return VCARD_EMUL_OK;
 }
-- 
1.7.9.3

  parent reply	other threads:[~2012-03-22 18:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-22 18:20 [Qemu-devel] [PATCH 0/3] libcacard: handle no readers on startup Alon Levy
2012-03-22 18:20 ` [Qemu-devel] [PATCH 1/3] libcacard/vcard_emul_nss: don't stop thread when there are no slots Alon Levy
2012-03-22 18:20 ` Alon Levy [this message]
2012-03-22 18:20 ` [Qemu-devel] [PATCH 3/3] libcacard/vcard_emul_nss: add warning for old coolkey Alon Levy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332440459-17518-3-git-send-email-alevy@redhat.com \
    --to=alevy@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rrelyea@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).