aboutsummaryrefslogtreecommitdiffstats
path: root/g10/cardglue.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-07-19 12:14:39 +0000
committerWerner Koch <[email protected]>2005-07-19 12:14:39 +0000
commita0b4f403018fc1fb54286174467f52fdf0426bf1 (patch)
tree691b98eaf69d9e2e56045711cdae199d2a369094 /g10/cardglue.c
parent* configure.ac [W32]: Always set DISABLE_KEYSERVER_PATH. (diff)
downloadgnupg-a0b4f403018fc1fb54286174467f52fdf0426bf1.tar.gz
gnupg-a0b4f403018fc1fb54286174467f52fdf0426bf1.zip
* g10.c, options.h: New option --limit-card-insert-tries.
* cardglue.c (open_card): Use it.
Diffstat (limited to '')
-rw-r--r--g10/cardglue.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/g10/cardglue.c b/g10/cardglue.c
index f9fba6806..0e2da279c 100644
--- a/g10/cardglue.c
+++ b/g10/cardglue.c
@@ -385,6 +385,7 @@ open_card (void)
int rc;
app_t app;
int did_shutdown = 0;
+ int retry_count = 0;
/* First check whether we can contact a gpg-agent and divert all
operation to it. This is required because gpg as well as the
@@ -421,7 +422,10 @@ open_card (void)
app = xcalloc (1, sizeof *app);
app->slot = slot;
rc = app_select_openpgp (app);
- if (rc && !opt.batch)
+ if (opt.limit_card_insert_tries
+ && ++retry_count >= opt.limit_card_insert_tries)
+ ;
+ else if (rc && !opt.batch)
{
write_status_text (STATUS_CARDCTRL, "1");