Blame SOURCES/0002-smartcard-Handle-VCARD_EMUL_INIT_ALREADY_INITED.patch

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