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 1/3] libcacard/vcard_emul_nss: don't stop thread when there are no slots
Date: Thu, 22 Mar 2012 20:20:57 +0200	[thread overview]
Message-ID: <1332440459-17518-2-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1332440459-17518-1-git-send-email-alevy@redhat.com>

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 libcacard/vcard_emul_nss.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index bdc3c79..7de5d5b 100644
--- a/libcacard/vcard_emul_nss.c
+++ b/libcacard/vcard_emul_nss.c
@@ -682,8 +682,19 @@ vcard_emul_event_thread(void *arg)
     SECMODModule *module = (SECMODModule *)arg;
 
     do {
+        /*
+         * XXX - the latency value doesn't matter one bit. you only get no
+         * blocking (flags |= CKF_DONT_BLOCK) or PKCS11_WAIT_LATENCY (==500),
+         * hard coded in coolkey.  And it isn't coolkey's fault - the timeout
+         * value we pass get's dropped on the floor before C_WaitForSlotEvent
+         * is called.
+         */
         slot = SECMOD_WaitForAnyTokenEvent(module, 0, 500);
         if (slot == NULL) {
+            /* this could be just a no event indication */
+            if (PORT_GetError() == SEC_ERROR_NO_EVENT) {
+                continue;
+            }
             break;
         }
         vreader = vcard_emul_find_vreader_from_slot(slot);
-- 
1.7.9.3

  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 ` Alon Levy [this message]
2012-03-22 18:20 ` [Qemu-devel] [PATCH 2/3] libcacard/vcard_emul_nss: handle no readers at startup Alon Levy
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-2-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).