diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2013-07-11 15:18:33 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2013-07-11 16:14:49 +0200 |
commit | 3bb15dd43daaed6b1d77e66c59432f228935322e (patch) | |
tree | 85ced27d4e06ab40ac48ac9079f74c8debe7144b | |
parent | 0db85b23b587807c31294b7344d805c7bd841bac (diff) |
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
-rw-r--r-- | gtk/smartcard-manager.c | 5 |
1 files changed, 4 insertions, 1 deletions
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"); |