diff options
author | Jim Rees <rees@cvs.openbsd.org> | 2001-07-17 16:14:26 +0000 |
---|---|---|
committer | Jim Rees <rees@cvs.openbsd.org> | 2001-07-17 16:14:26 +0000 |
commit | 198159af3d33985b2f05e230753713c48838fd06 (patch) | |
tree | c495b0276a0195da35313c0509376cb8afedde61 /lib/libsectok | |
parent | 2d3fbf5e4af46c8fc23cc3416c3d87a66369d969 (diff) |
always return a valid status word from sectok_apdu()
Diffstat (limited to 'lib/libsectok')
-rw-r--r-- | lib/libsectok/sectok.c | 16 |
1 files changed, 11 insertions, 5 deletions
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) { |