From f48d45b16c969bf6357028da3b32cbd20cf1d121 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Sat, 9 Feb 2013 23:43:26 +0100 Subject: [PATCH] fixed bug in iso sm driver --- npa/src/iso-sm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/npa/src/iso-sm.c b/npa/src/iso-sm.c index 0684ecd..afa5193 100644 --- a/npa/src/iso-sm.c +++ b/npa/src/iso-sm.c @@ -765,6 +765,8 @@ int iso_sm_start(struct sc_card *card, struct iso_sm_ctx *sctx) card->sm_ctx.ops.free_sm_apdu = iso_free_sm_apdu; card->sm_ctx.ops.get_sm_apdu = iso_get_sm_apdu; card->sm_ctx.sm_mode = SM_MODE_TRANSMIT; + + return SC_SUCCESS; } int sm_stop(struct sc_card *card) @@ -772,7 +774,8 @@ int sm_stop(struct sc_card *card) int r = SC_SUCCESS; if (card) { - if (card->sm_ctx.ops.close) + if (card->sm_ctx.sm_mode == SM_MODE_TRANSMIT + && card->sm_ctx.ops.close) r = card->sm_ctx.ops.close(card); card->sm_ctx.sm_mode = SM_MODE_NONE; }