scd: When reader is specified, make sure only open once.

* scd/apdu.c (apdu_open_reader): Make sure not to try multiple times,
when PORTSTR is specified.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2021-05-06 19:05:30 +09:00
parent 8d81fd7c01
commit d6fe82d3d1
1 changed files with 5 additions and 0 deletions

View File

@ -2142,6 +2142,11 @@ apdu_open_reader (struct dev_list *dl)
if (readerno < 0 || readerno >= dl->idx_max)
return -1;
/* If already opened HANDLE, return -1. */
for (slot = 0; slot < MAX_READER; slot++)
if (reader_table[slot].used)
return -1;
dl->idx = readerno;
dl->portstr = NULL;
}