From fe42e998d05e45d46b2d5c043a72151e4a38aaa1 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Mon, 15 Sep 2025 08:39:06 +0200 Subject: [PATCH] fixed SonarCloud issues Signed-off-by: Toni Uhlig --- nDPId-test.c | 11 ++++++++--- nDPId.c | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/nDPId-test.c b/nDPId-test.c index db4d650cb..c2d34b2e1 100644 --- a/nDPId-test.c +++ b/nDPId-test.c @@ -1529,6 +1529,8 @@ static int nio_selftest() logger(0, "%s", "Using poll for nio"); #endif + int pipefds[2] = {-1, -1}; + #ifdef ENABLE_EPOLL if (nio_use_epoll(&io, 32) != NIO_SUCCESS) #else @@ -1539,7 +1541,6 @@ static int nio_selftest() goto error; } - int pipefds[2] = {-1, -1}; int rv = pipe(pipefds); if (rv < 0) { @@ -1637,8 +1638,12 @@ static int nio_selftest() return 0; error: nio_free(&io); - close(pipefds[0]); - close(pipefds[1]); + if (pipefds[0] >= 0) { + close(pipefds[0]); + } + if (pipefds[1] >= 0) { + close(pipefds[1]); + } return 1; } diff --git a/nDPId.c b/nDPId.c index 42d5059fd..9338496e6 100644 --- a/nDPId.c +++ b/nDPId.c @@ -5699,7 +5699,7 @@ static int nDPId_parse_options(int argc, char ** argv) set_cmdarg_string(&nDPId_options.client_crt_pem_file, optarg); break; #else - logger(1, "%s", "nDPId was built w/o OpenSSL/Crypto support"); + logger(1, "Client cert PEM file: %s", "nDPId was built w/o OpenSSL/Crypto support"); return 1; #endif case 'K': @@ -5707,7 +5707,7 @@ static int nDPId_parse_options(int argc, char ** argv) set_cmdarg_string(&nDPId_options.client_key_pem_file, optarg); break; #else - logger(1, "%s", "nDPId was built w/o OpenSSL/Crypto support"); + logger(1, "Client key PEM file: %s", "nDPId was built w/o OpenSSL/Crypto support"); return 1; #endif case 'F': @@ -5715,7 +5715,7 @@ static int nDPId_parse_options(int argc, char ** argv) set_cmdarg_string(&nDPId_options.server_ca_pem_file, optarg); break; #else - logger(1, "%s", "nDPId was built w/o OpenSSL/Crypto support"); + logger(1, "Server CA PEM file: %s", "nDPId was built w/o OpenSSL/Crypto support"); return 1; #endif case 'e':