From a8019413c42ca203c3c52fcffe9fd3df5556e2f3 Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Tue, 7 Mar 2023 18:53:39 +0000 Subject: [PATCH] fix compilation on old distros --- .../mariadb_lib.c.x509cache.patch | 9 +++++---- .../openssl.c.x509cache.patch | 16 ++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/deps/mariadb-client-library/mariadb_lib.c.x509cache.patch b/deps/mariadb-client-library/mariadb_lib.c.x509cache.patch index 216825196..1cbae1381 100644 --- a/deps/mariadb-client-library/mariadb_lib.c.x509cache.patch +++ b/deps/mariadb-client-library/mariadb_lib.c.x509cache.patch @@ -10,17 +10,18 @@ #define CONNECT_TIMEOUT 0 struct st_mariadb_methods MARIADB_DEFAULT_METHODS; -@@ -4078,6 +4083,18 @@ +@@ -4078,6 +4083,19 @@ void STDCALL mysql_thread_end(void) { + if (local_x509_files != NULL) { -+ for (int i=0; local_x509_files[i] != NULL ; i++) { ++ int i; ++ for (i=0; local_x509_files[i] != NULL ; i++) { + free(local_x509_files[i]); + free(local_x509_sha1s[i]); + } -+ free(local_x509_files); -+ free(local_x509_sha1s); ++ free(local_x509_files); ++ free(local_x509_sha1s); + } + if (thread_ctx != NULL) { + SSL_CTX_free(thread_ctx); diff --git a/deps/mariadb-client-library/openssl.c.x509cache.patch b/deps/mariadb-client-library/openssl.c.x509cache.patch index b8037f51c..722ba369f 100644 --- a/deps/mariadb-client-library/openssl.c.x509cache.patch +++ b/deps/mariadb-client-library/openssl.c.x509cache.patch @@ -35,14 +35,14 @@ + + if(fstat(fd, &statbuf) == 0) { + unsigned char *fb = (unsigned char *)mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0); -+ if (fb != MAP_FAILED) { -+ -+ SHA1(fb, statbuf.st_size, temp); -+ for (int i=0; i < SHA_DIGEST_LENGTH; i++) { -+ sprintf((char*)&(file_sha1[i*2]), "%02x", temp[i]); -+ } -+ munmap(fb,statbuf.st_size); -+ } else { ++ if (fb != MAP_FAILED) { ++ SHA1(fb, statbuf.st_size, temp); ++ int i; ++ for (i=0; i < SHA_DIGEST_LENGTH; i++) { ++ sprintf((char*)&(file_sha1[i*2]), "%02x", temp[i]); ++ } ++ munmap(fb,statbuf.st_size); ++ } else { + return 0; + } + } else {