spice-gtk/0002-smartcard-Handle-VCARD_EMUL_INIT_ALREADY_INITED.patch
Christophe Fergeau 902342efb0 Add misc upstream patches
They fix various bugs found in spice-gtk 0.20
2013-09-13 14:22:28 +02:00

46 lines
1.7 KiB
Diff

From 3bb15dd43daaed6b1d77e66c59432f228935322e Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@redhat.com>
Date: Thu, 11 Jul 2013 15:18:33 +0200
Subject: [spice-gtk] smartcard: Handle VCARD_EMUL_INIT_ALREADY_INITED
When initializing a software smartcard, vcard_emul_init() can
report success, error, or indicate that initialization has already
been done. In this last case, we would assume that an error occurred
instead of behaving as if the initialization succeeded.
vcard_emul_init() can end up being called multiple time if the
smartcard channel gets destroyed and recreated during the lifetime
of the application
Fixes rhbz#815639
---
gtk/smartcard-manager.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gtk/smartcard-manager.c b/gtk/smartcard-manager.c
index 4b1efe2..2a0e397 100644
--- a/gtk/smartcard-manager.c
+++ b/gtk/smartcard-manager.c
@@ -408,6 +408,7 @@ static gboolean smartcard_manager_init(SpiceSession *session,
{
gchar *emul_args = NULL;
VCardEmulOptions *options = NULL;
+ VCardEmulError emul_init_status;
gchar *dbname = NULL;
GStrv certificates = NULL;
gboolean retval = FALSE;
@@ -448,7 +449,9 @@ static gboolean smartcard_manager_init(SpiceSession *session,
init:
SPICE_DEBUG("vcard_emul_init");
- if (vcard_emul_init(options) != VCARD_EMUL_OK) {
+ emul_init_status = vcard_emul_init(options);
+ if ((emul_init_status != VCARD_EMUL_OK)
+ && (emul_init_status != VCARD_EMUL_INIT_ALREADY_INITED)) {
*err = g_error_new(SPICE_CLIENT_ERROR,
SPICE_CLIENT_ERROR_FAILED,
"Failed to initialize smartcard");
--
1.8.3.1