summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2013-06-12 12:17:51 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2013-06-24 17:18:28 +0200
commit579be67f26e7569a78c5dace9adbc771182198df (patch)
treee2a299ce4996e7bdfe6cd633a70d44be35d446db
parent72185f506171d387c24343bdad1621d1acb99609 (diff)
smartcard: Report failure when software reader is missing
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.
-rw-r--r--gtk/smartcard-manager.c6
1 files 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);