From 198159af3d33985b2f05e230753713c48838fd06 Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Tue, 17 Jul 2001 16:14:26 +0000 Subject: always return a valid status word from sectok_apdu() --- lib/libsectok/sectok.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/libsectok') diff --git a/lib/libsectok/sectok.c b/lib/libsectok/sectok.c index 5a760fc723c..c9b585f91bf 100644 --- a/lib/libsectok/sectok.c +++ b/lib/libsectok/sectok.c @@ -1,4 +1,4 @@ -/* $Id: sectok.c,v 1.4 2001/07/02 20:07:09 rees Exp $ */ +/* $Id: sectok.c,v 1.5 2001/07/17 16:14:25 rees Exp $ */ /* copyright 2000 @@ -399,8 +399,10 @@ sectok_apdu(int fd, int cla, int ins, int p1, int p2, readerInfo *reader = &readers[fd]; struct SCARD_IO_HEADER garbage; - if (reader->driverLoaded == 0) - return STECLOSED; + if (reader->driverLoaded == 0) { + *swp = STECLOSED; + return -1; + } cmd[0] = cla; cmd[1] = ins; @@ -426,15 +428,19 @@ sectok_apdu(int fd, int cla, int ins, int p1, int p2, cmd[2] = cmd[3] = 0; cmd[4] = rsp[n-1]; n = sizeof rsp; - if (reader->data(garbage, cmd, 5, rsp, &n, NULL)) + if (reader->data(garbage, cmd, 5, rsp, &n, NULL)) { + *swp = STECOMM; return -1; + } } } else { /* Get "out" data */ cmd[4] = olen; n = sizeof rsp; - if (reader->data(garbage, cmd, 5, rsp, &n, NULL)) + if (reader->data(garbage, cmd, 5, rsp, &n, NULL)) { + *swp = STECOMM; return -1; + } } if (n >= 2) { -- cgit v1.2.3