From eb70bf3fbc69459043196de96030ada6015ce27f Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Wed, 28 Dec 2016 12:44:27 +0100 Subject: Cleanup --- common.c | 15 +++++++++++++++ degesch.c | 10 +--------- kike.c | 11 +---------- zyklonb.c | 12 +----------- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/common.c b/common.c index 347e82b..a822847 100644 --- a/common.c +++ b/common.c @@ -34,6 +34,21 @@ #include #include +static void +init_openssl (void) +{ +#if OPENSSL_VERSION_NUMBER < 0x10100000L + SSL_library_init (); + // XXX: this list is probably not complete + atexit (EVP_cleanup); + SSL_load_error_strings (); + atexit (ERR_free_strings); +#else + // Cleanup is done automatically via atexit() + OPENSSL_init_ssl (0, NULL); +#endif +} + // --- To be moved to liberty -------------------------------------------------- static ssize_t diff --git a/degesch.c b/degesch.c index 3263ae0..6156981 100644 --- a/degesch.c +++ b/degesch.c @@ -14009,15 +14009,7 @@ main (int argc, char *argv[]) app_context_init (&ctx); g_ctx = &ctx; -#if OPENSSL_VERSION_NUMBER < 0x10100000L - SSL_library_init (); - atexit (EVP_cleanup); - SSL_load_error_strings (); - atexit (ERR_free_strings); -#else - // Cleanup is done automatically via atexit() - OPENSSL_init_ssl (0, NULL); -#endif + init_openssl (); // Bootstrap configuration, so that we can access schema items at all register_config_modules (&ctx); diff --git a/kike.c b/kike.c index da9bdc5..aba5bba 100644 --- a/kike.c +++ b/kike.c @@ -4043,16 +4043,7 @@ main (int argc, char *argv[]) print_status (PROGRAM_NAME " " PROGRAM_VERSION " starting"); setup_signal_handlers (); - -#if OPENSSL_VERSION_NUMBER < 0x10100000L - SSL_library_init (); - atexit (EVP_cleanup); - SSL_load_error_strings (); - atexit (ERR_free_strings); -#else - // Cleanup is done automatically via atexit() - OPENSSL_init_ssl (0, NULL); -#endif + init_openssl (); struct server_context ctx; server_context_init (&ctx); diff --git a/zyklonb.c b/zyklonb.c index 3688a6a..e84134c 100644 --- a/zyklonb.c +++ b/zyklonb.c @@ -2010,17 +2010,7 @@ main (int argc, char *argv[]) print_status (PROGRAM_NAME " " PROGRAM_VERSION " starting"); setup_signal_handlers (); - -#if OPENSSL_VERSION_NUMBER < 0x10100000L - SSL_library_init (); - // XXX: this list is probably not complete - atexit (EVP_cleanup); - SSL_load_error_strings (); - atexit (ERR_free_strings); -#else - // Cleanup is done automatically via atexit() - OPENSSL_init_ssl (0, NULL); -#endif + init_openssl (); struct bot_context ctx; bot_context_init (&ctx); -- cgit v1.2.3-70-g09d2