[Spice-devel] [spice-gtk 1/2] smartcard: Handle VCARD_EMUL_INIT_ALREADY_INITED

Marc-André Lureau mlureau at redhat.com
Thu Jul 11 07:42:19 PDT 2013


ack series

----- Mensaje original -----
> 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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list