@@ -128,6 +128,7 @@ static SCOSSL_STATUS logging_thread_exit_status = SCOSSL_FAILURE;
128128// Internal function declarations
129129//
130130
131+ static BOOL is_keysinuse_enabled ();
131132static void keysinuse_init_internal ();
132133static void keysinuse_cleanup_internal ();
133134static void keysinuse_teardown ();
@@ -147,6 +148,17 @@ static void *keysinuse_logging_thread_start(ossl_unused void *arg);
147148// Setup/teardown
148149//
149150
151+ static BOOL is_keysinuse_enabled ()
152+ {
153+ const char * env_enabled = getenv ("KEYSINUSE_ENABLED" );
154+ if (env_enabled != NULL && strcmp (env_enabled , "0" ) == 0 )
155+ {
156+ keysinuse_enabled = FALSE;
157+ }
158+
159+ return keysinuse_enabled ;
160+ }
161+
150162#ifndef KEYSINUSE_LOG_SYSLOG
151163static SCOSSL_STATUS keysinuse_init_logging ()
152164{
@@ -236,16 +248,7 @@ static void keysinuse_init_internal()
236248 int pthreadErr ;
237249 SCOSSL_STATUS status = SCOSSL_FAILURE ;
238250
239- const char * env_enabled = getenv ("KEYSINUSE_ENABLED" );
240- if (env_enabled != NULL )
241- {
242- if (strcmp (env_enabled , "0" ) == 0 )
243- {
244- keysinuse_enabled = FALSE;
245- }
246- }
247-
248- if (!keysinuse_enabled )
251+ if (!is_keysinuse_enabled ())
249252 {
250253 return ;
251254 }
@@ -394,7 +397,7 @@ static void keysinuse_atfork_reinit()
394397 }
395398
396399 // Only recreate logging thread if it was running in the parent process and keysinuse is enabled
397- if (is_parent_logging && is_parent_running && keysinuse_enabled )
400+ if (is_parent_logging && is_parent_running && is_keysinuse_enabled () )
398401 {
399402 // Start the logging thread. Monotonic clock needs to be set to
400403 // prevent wall clock changes from affecting the logging delay sleep time
0 commit comments