init: fix defined but unused warning/error
The #ifdefs weren't quite correct at times.
@@ -650,16 +650,15 @@ int OPENSSL_atexit(void (*handler)(void))
#if !defined(OPENSSL_USE_NODELETE)\
&& !defined(OPENSSL_NO_PINSHARED)
{
+# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
+ HMODULE handle = NULL;
+ BOOL ret;
union {
void *sym;
void (*func)(void);
} handlersym;
handlersym.func = handler;
-# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
- {
- HMODULE handle = NULL;
- BOOL ret;
/*
* We don't use the DSO route for WIN32 because there is a better
@@ -671,7 +670,6 @@ int OPENSSL_atexit(void (*handler)(void))
if (!ret)
return 0;
- }
# elif !defined(DSO_NONE)
/*
* Deliberately leak a reference to the handler. This will force the
@@ -679,8 +677,13 @@ int OPENSSL_atexit(void (*handler)(void))
* atexit handler. If -znodelete has been used then this is
* unnecessary.
*/
- {
DSO *dso = NULL;
+ union {
+ void *sym;
+ void (*func)(void);
+ } handlersym;
+
+ handlersym.func = handler;
ERR_set_mark();
dso = DSO_dsobyaddr(handlersym.sym, DSO_FLAG_NO_UNLOAD_ON_FREE);
@@ -690,7 +693,6 @@ int OPENSSL_atexit(void (*handler)(void))
(dso == NULL ? "No!" : "Yes."));
DSO_free(dso);
ERR_pop_to_mark();
- }
# endif
}
#endif
