summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2014-02-10 17:58:49 -0500
committerRay Strode <rstrode@redhat.com>2014-02-10 17:58:49 -0500
commit35c43517aba0d53f25301ecb3d58c6f1e808a6cf (patch)
tree1348f8cc71b85da8107c956914590759ebd94dc8
parent1a42dde560025b056d35ebf7ffd4175e3268ea04 (diff)
downloadgnome-settings-daemon-wip/smartcard-fixes.tar.gz
asdf# plugins/cursor/fix-cursor.patch
-rw-r--r--plugins/smartcard/gsd-smartcard-manager.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/plugins/smartcard/gsd-smartcard-manager.c b/plugins/smartcard/gsd-smartcard-manager.c
index 5601d849..1d531c2b 100644
--- a/plugins/smartcard/gsd-smartcard-manager.c
+++ b/plugins/smartcard/gsd-smartcard-manager.c
@@ -151,6 +151,7 @@ typedef struct
{
SECMODModule *driver;
GHashTable *smartcards;
+ int number_of_consecutive_errors;
} WatchSmartcardsOperation;
static void
@@ -191,16 +192,25 @@ watch_one_event_from_driver (GsdSmartcardManager *self,
error_code = PORT_GetError ();
- g_warning ("smartcard event function failed.");
+ operation->number_of_consecutive_errors++;
+ if (operation->number_of_consecutive_errors > 10) {
+ g_warning ("Got %d consecutive smartcard errors, so giving up.");
+
+ g_set_error (error,
+ GSD_SMARTCARD_MANAGER_ERROR,
+ GSD_SMARTCARD_MANAGER_ERROR_WITH_NSS,
+ "encountered unexpected error while "
+ "waiting for smartcard events (error %x)",
+ error_code);
+ return FALSE;
+ }
- g_set_error (error,
- GSD_SMARTCARD_MANAGER_ERROR,
- GSD_SMARTCARD_MANAGER_ERROR_WITH_NSS,
- "encountered unexpected error while "
- "waiting for smartcard events (error %d)",
- error_code);
- return FALSE;
+ g_warning ("Got potentially spurious smartcard event error: %x.", error_code);
+
+ sleep (1);
+ return TRUE;
}
+ operation->number_of_consecutive_errors = 0;
slot_id = PK11_GetSlotID (card);
slot_series = PK11_GetSlotSeries (card);