diff options
Diffstat (limited to 'agent/call-scd.c')
-rw-r--r-- | agent/call-scd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/agent/call-scd.c b/agent/call-scd.c index f3303c11d..93f1cf742 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -176,6 +176,17 @@ agent_scd_dump_state (void) static int unlock_scd (ctrl_t ctrl, int rc) { + if (gpg_err_code (rc) == GPG_ERR_NOT_OPERATIONAL + && gpg_err_source (rc) == GPG_ERR_SOURCE_SCD) + { + /* If the SCdaemon returned this error, it detected a major + problem, like no reader connected. To finish this we need to + stop the connection. This simulates an explicit killing of + the SCdaemon. */ + assuan_transact (primary_scd_ctx, "BYE", + NULL, NULL, NULL, NULL, NULL, NULL); + } + if (ctrl->scd_local->locked != 1) { log_error ("unlock_scd: invalid lock count (%d)\n", |