From 9e3561e508a22ea6dcfb00d9e80d7a653efd0e8b Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 7 Oct 2014 16:29:58 +0200 Subject: idevice: Fix compilation with OpenSSL before 1.0.0-beta1 --- src/idevice.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/idevice.c b/src/idevice.c index 4fae693..7ec46ed 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -37,6 +37,10 @@ #ifdef HAVE_OPENSSL #include #include +#if OPENSSL_VERSION_NUMBER >= 0x10000001L +/* since OpenSSL 1.0.0-beta1 */ +#define HAVE_ERR_REMOVE_THREAD_STATE 1 +#endif #else #include #endif @@ -96,7 +100,11 @@ static void internal_idevice_deinit(void) EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); sk_SSL_COMP_free(SSL_COMP_get_compression_methods()); +#ifdef HAVE_ERR_REMOVE_THREAD_STATE ERR_remove_thread_state(NULL); +#else + ERR_remove_state(0); +#endif #else gnutls_global_deinit(); #endif @@ -717,7 +725,11 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_enable_ssl(idevice_conne debug_info("SSL mode enabled, cipher: %s", SSL_get_cipher(ssl)); } /* required for proper multi-thread clean up to prevent leaks */ +#ifdef HAVE_ERR_REMOVE_THREAD_STATE ERR_remove_thread_state(NULL); +#else + ERR_remove_state(0); +#endif #else ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private)); -- cgit v1.1-32-gdbae