[Spice-devel] [spice-gtk 1/4] smartcard: Report failure when software reader is missing

Marc-André Lureau marcandre.lureau at gmail.com
Thu Jun 20 12:01:02 PDT 2013


ack series,



On Wed, Jun 19, 2013 at 5:33 PM, Christophe Fergeau <cfergeau at redhat.com>wrote:

> As there is no easy way to know if the SpiceSmartcardManager
> has an associated software reader or not, it's better to report
> failure instead of g_return_if_fail on attempts to use
> spice_smartcard_manager_insert/remove_card with no software reader
> available.
> ---
>  gtk/smartcard-manager.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/gtk/smartcard-manager.c b/gtk/smartcard-manager.c
> index 51f228a..3b86dfb 100644
> --- a/gtk/smartcard-manager.c
> +++ b/gtk/smartcard-manager.c
> @@ -552,7 +552,8 @@ gboolean
> spice_smartcard_manager_insert_card(SpiceSmartcardManager *manager)
>  {
>      VCardEmulError status;
>
> -    g_return_val_if_fail(manager->priv->software_reader != NULL, FALSE);
> +    if (manager->priv->software_reader != NULL)
> +        return FALSE;
>
>      status = vcard_emul_force_card_insert(manager->priv->software_reader);
>
> @@ -574,7 +575,8 @@ gboolean
> spice_smartcard_manager_remove_card(SpiceSmartcardManager *manager)
>  {
>      VCardEmulError status;
>
> -    g_return_val_if_fail(manager->priv->software_reader != NULL, FALSE);
> +    if (manager->priv->software_reader != NULL)
> +        return FALSE;
>
>      status = vcard_emul_force_card_remove(manager->priv->software_reader);
>
> --
> 1.8.2.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>



-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130620/38a85984/attachment.html>


More information about the Spice-devel mailing list