From patchwork Thu Mar 22 18:20:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 148290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BE604B6F13 for ; Fri, 23 Mar 2012 05:21:33 +1100 (EST) Received: from localhost ([::1]:33777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAmde-0002as-LU for incoming@patchwork.ozlabs.org; Thu, 22 Mar 2012 14:21:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAmdJ-0002Od-MZ for qemu-devel@nongnu.org; Thu, 22 Mar 2012 14:21:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAmdE-0001Vk-Ff for qemu-devel@nongnu.org; Thu, 22 Mar 2012 14:21:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAmdE-0001Uf-6y for qemu-devel@nongnu.org; Thu, 22 Mar 2012 14:21:04 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2MIL23O029133 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 22 Mar 2012 14:21:02 -0400 Received: from garlic.tlv.redhat.com (spice-ovirt.tlv.redhat.com [10.35.4.71]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q2MIL0di017650; Thu, 22 Mar 2012 14:21:01 -0400 From: Alon Levy To: qemu-devel@nongnu.org, rrelyea@redhat.com Date: Thu, 22 Mar 2012 20:20:57 +0200 Message-Id: <1332440459-17518-2-git-send-email-alevy@redhat.com> In-Reply-To: <1332440459-17518-1-git-send-email-alevy@redhat.com> References: <1332440459-17518-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/3] libcacard/vcard_emul_nss: don't stop thread when there are no slots X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Alon Levy --- 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);