pcsc-relay: allow no-ops when sending/receiving

This commit is contained in:
Frank Morgner
2024-02-27 10:57:12 +01:00
parent 1a395716cb
commit 780cc7c4fa
3 changed files with 27 additions and 22 deletions

View File

@@ -208,15 +208,13 @@ static int picc_receive_capdu(driver_data_t *driver_data,
/* read C-APDU */
linelen = getline(&data->line, &data->linemax, data->fd);
if (linelen <= 0) {
if (linelen < 0) {
RELAY_ERROR("Error reading from %s: %s\n", PICCDEV, strerror(errno));
return 0;
}
if (linelen == 0) {
*len = 0;
return 1;
}
if (linelen < 0) {
RELAY_ERROR("Error reading from %s: %s\n", PICCDEV, strerror(errno));
return 0;
}
if (linelen == 0) {
*len = 0;
return 1;
}
if (fflush(data->fd) != 0)
RELAY_ERROR("Warning, fflush failed: %s\n", strerror(errno));
@@ -237,6 +235,9 @@ static int picc_send_rapdu(driver_data_t *driver_data,
if (!data || !rapdu)
return 0;
if (!len)
return 1;
/* encode R-APDU */
if (!picc_encode_rapdu(rapdu, len, &data->e_rapdu, &buflen))