From 143379df56ee5e1ea7092304c2deef1d684fdcdc Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 30 Jun 2025 11:40:40 +0200 Subject: [PATCH] src: -Wunreachable-code error in crypto_context.cc PR-URL: https://github.com/nodejs/node/pull/58901 Reviewed-By: James M Snell Reviewed-By: Chengzhong Wu Reviewed-By: Anna Henningsen Reviewed-By: Vladimir Morozov --- src/crypto/crypto_context.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc index 1ffce89df5f..798b4ffb52b 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -77,8 +77,6 @@ static const char* const root_certs[] = { #include "node_root_certs.h" // NOLINT(build/include_order) }; -static const char system_cert_path[] = NODE_OPENSSL_SYSTEM_CERT_PATH; - static std::string extra_root_certs_file; // NOLINT(runtime/string) static std::atomic has_cached_bundled_root_certs{false}; @@ -838,11 +836,13 @@ X509_STORE* NewRootCertStore() { X509_STORE* store = X509_STORE_new(); CHECK_NOT_NULL(store); - if (*system_cert_path != '\0') { +#ifdef NODE_OPENSSL_SYSTEM_CERT_PATH + if constexpr (sizeof(NODE_OPENSSL_SYSTEM_CERT_PATH) > 1) { ERR_set_mark(); - X509_STORE_load_locations(store, system_cert_path, nullptr); + X509_STORE_load_locations(store, NODE_OPENSSL_SYSTEM_CERT_PATH, nullptr); ERR_pop_to_mark(); } +#endif Mutex::ScopedLock cli_lock(node::per_process::cli_options_mutex); if (per_process::cli_options->ssl_openssl_cert_store) {