opensc-explorer: re-factor read_and_print_record_file()

* replace magic magic number used as potentially too small buffer size
  by SC_MAX_EXT_APDU_RESP_SIZE
* start error message with upper-case letter
* return 0 on success
This commit is contained in:
Peter Marschall 2020-02-08 19:21:59 +01:00 committed by Frank Morgner
parent 9b0983e96d
commit b2f86b3997
1 changed files with 4 additions and 2 deletions

View File

@ -780,7 +780,7 @@ err:
static int read_and_print_record_file(sc_file_t *file, unsigned char sfi)
{
u8 buf[256];
u8 buf[SC_MAX_EXT_APDU_RESP_SIZE];
int rec, r;
for (rec = 1; ; rec++) {
@ -794,12 +794,14 @@ static int read_and_print_record_file(sc_file_t *file, unsigned char sfi)
if (r == SC_ERROR_RECORD_NOT_FOUND)
return 0;
if (r < 0) {
check_ret(r, SC_AC_OP_READ, "read failed", file);
check_ret(r, SC_AC_OP_READ, "Read failed", file);
return -1;
}
printf("Record %d:\n", rec);
util_hex_dump_asc(stdout, buf, r, 0);
}
return 0;
}
static int do_cat(int argc, char **argv)