From: Fabian Keil <fk@fabiankeil.de>
Date: Sat, 19 Dec 2020 16:11:42 +0000 (+0100)
Subject: create_server_ssl_connection(): Declare a variable at the beginning of the code block
X-Git-Tag: v_3_0_30~188
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/developer-manual/faq/@default-cgi@edit-actions-list?a=commitdiff_plain;h=3b4813587fa2eab6daed2738f455a7145fb31f1e;p=privoxy.git

create_server_ssl_connection(): Declare a variable at the beginning of the code block

... to silence:
    cc -c -pipe -fstack-protector-all -ggdb -Wshadow  -Wconversion -I/usr/local/include/  -pthread -Wall -std=c89   openssl.c -o openssl.o
    openssl.c:1144:12: warning: GCC does not allow variable declarations in for loop initializers before C99 [-Wgcc-compat]
          for (int i = 0; i < sk_X509_num(chain); i++)
               ^
---

diff --git a/openssl.c b/openssl.c
index 32f8f278..ecfb6bf8 100644
--- a/openssl.c
+++ b/openssl.c
@@ -1141,7 +1141,8 @@ extern int create_server_ssl_connection(struct client_state *csp)
    chain = SSL_get_peer_cert_chain(ssl);
    if (chain)
    {
-      for (int i = 0; i < sk_X509_num(chain); i++)
+      int i;
+      for (i = 0; i < sk_X509_num(chain); i++)
       {
          if (ssl_store_cert(csp, sk_X509_value(chain, i)) != 0)
          {