src/tools/pkcs11_eventmgr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/tools/pkcs11_eventmgr.c b/src/tools/pkcs11_eventmgr.c index 0ec28be..2d28536 100644 --- a/src/tools/pkcs11_eventmgr.c +++ b/src/tools/pkcs11_eventmgr.c @@ -602,9 +602,8 @@ int main(int argc, char *argv[]) #else int rv; - int first_loop = 0; - int old_state = CARD_NOT_PRESENT; - int new_state = CARD_NOT_PRESENT; + int old_state = CARD_ERROR; + int new_state = old_state; int expire_count = 0; /* parse args and configuration file */ @@ -701,10 +700,14 @@ int main(int argc, char *argv[]) } else { /* state changed; parse event */ - old_state = new_state; + if (old_state == CARD_ERROR) { + old_state = new_state; + continue; + } else { + old_state = new_state; + } expire_count = 0; - if (!first_loop++) - continue; /*skip first pass */ + if (new_state == CARD_NOT_PRESENT) { DBG("Card removed, ");