Avoid "unused variable" warning on non-USE_SSL_ENGINE platforms.
authorTom Lane
Mon, 1 Apr 2024 23:01:18 +0000 (19:01 -0400)
committerTom Lane
Mon, 1 Apr 2024 23:01:18 +0000 (19:01 -0400)
If we are building with openssl but USE_SSL_ENGINE didn't get set,
initialize_SSL's variable "pkey" is declared but used nowhere.
Apparently this combination hasn't been exercised in the buildfarm
before now, because I've not seen this warning before, even though
the code has been like this a long time.  Move the declaration
to silence the warning (and remove its useless initialization).

Per buildfarm member sawshark.  Back-patch to all supported branches.

src/interfaces/libpq/fe-secure-openssl.c

index c2858096b5dac1a9da8a23b86cbccb39abf50d72..a44d7d3f29e0889e2964992936fa105f9f92eabb 100644 (file)
@@ -915,7 +915,6 @@ initialize_SSL(PGconn *conn)
    bool        have_homedir;
    bool        have_cert;
    bool        have_rootcert;
-   EVP_PKEY   *pkey = NULL;
 
    /*
     * We'll need the home directory if any of the relevant parameters are
@@ -1265,6 +1264,7 @@ initialize_SSL(PGconn *conn)
            /* Colon, but not in second character, treat as engine:key */
            char       *engine_str = strdup(conn->sslkey);
            char       *engine_colon;
+           EVP_PKEY   *pkey;
 
            if (engine_str == NULL)
            {