From 002e61dadf6f20597fcac220c11e1eb6552a2a11 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Mon, 9 Sep 2024 16:02:50 +0200 Subject: [PATCH] fixed handling error cases fixes CID 443645, thanks coverity scan (cherry picked from commit ffea1e0e97a89e8092ffdfc4b5b006633e1500e2) --- virtualsmartcard/src/vpcd/vpcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virtualsmartcard/src/vpcd/vpcd.c b/virtualsmartcard/src/vpcd/vpcd.c index 60e5891..cb5b6f6 100644 --- a/virtualsmartcard/src/vpcd/vpcd.c +++ b/virtualsmartcard/src/vpcd/vpcd.c @@ -284,7 +284,7 @@ int vicc_eject(struct vicc_ctx *ctx) int r = 0; if (ctx && ctx->client_sock != INVALID_SOCKET) { if (close(ctx->client_sock) < 0) { - r -= 1; + r = -1; } ctx->client_sock = INVALID_SOCKET; } @@ -347,7 +347,7 @@ int vicc_exit(struct vicc_ctx *ctx) if (ctx->server_sock != INVALID_SOCKET) { ctx->server_sock = close(ctx->server_sock); if (ctx->server_sock == INVALID_SOCKET) { - r -= 1; + r = -1; } } free(ctx);