From 35c43517aba0d53f25301ecb3d58c6f1e808a6cf Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Mon, 10 Feb 2014 17:58:49 -0500 Subject: sdfasdf asdf# plugins/cursor/fix-cursor.patch --- plugins/smartcard/gsd-smartcard-manager.c | 26 ++++++++++++++++++-------- 1 file 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); -- cgit v1.2.1