create_server_ssl_connection(): Declare a variable at the beginning of the code block
authorFabian Keil <fk@fabiankeil.de>
Sat, 19 Dec 2020 16:11:42 +0000 (17:11 +0100)
committerFabian Keil <fk@fabiankeil.de>
Sun, 20 Dec 2020 09:59:39 +0000 (10:59 +0100)
... 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++)
               ^

openssl.c

index 32f8f27..ecfb6bf 100644 (file)
--- 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)
    {
    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)
          {
       {
          if (ssl_store_cert(csp, sk_X509_value(chain, i)) != 0)
          {