diff --git a/virtualsmartcard/src/vpcd/vpcd.c b/virtualsmartcard/src/vpcd/vpcd.c index 26fb744..157e89d 100644 --- a/virtualsmartcard/src/vpcd/vpcd.c +++ b/virtualsmartcard/src/vpcd/vpcd.c @@ -110,11 +110,15 @@ static int opensock(unsigned short port) server_sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(sock, (struct sockaddr *) &server_sockaddr, - sizeof server_sockaddr) != 0) + sizeof server_sockaddr) != 0) { + perror(NULL); goto err; + } - if (listen(sock, 0) != 0) + if (listen(sock, 0) != 0) { + perror(NULL); goto err; + } return sock; @@ -327,9 +331,12 @@ ssize_t vicc_transmit(struct vicc_ctx *ctx, ssize_t r = -1; if (ctx && lock(ctx->io_lock)) { - r = sendToVICC(ctx, apdu_len, apdu); + if (apdu_len && apdu) + r = sendToVICC(ctx, apdu_len, apdu); + else + r = 1; - if (r > 0) + if (r > 0 && rapdu) r = recvFromVICC(ctx, rapdu); unlock(ctx->io_lock); diff --git a/virtualsmartcard/src/vpcd/vpcd.h b/virtualsmartcard/src/vpcd/vpcd.h index 7544cad..b4e2175 100644 --- a/virtualsmartcard/src/vpcd/vpcd.h +++ b/virtualsmartcard/src/vpcd/vpcd.h @@ -42,12 +42,6 @@ extern "C" { /** Standard port of the virtual smart card reader */ #define VPCDPORT 35963 -/** how long to wait for a card in seconds */ -extern long vpcd_waitsecs; - -/** how long to wait for a card in microseconds */ -extern long vpcd_waitusecs; - /** * @brief Initialize the module *