Prevent aliasing warning
authorDr. Stephen Henson <steve@openssl.org>
Sun, 4 Oct 2009 14:02:35 +0000 (14:02 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 4 Oct 2009 14:02:35 +0000 (14:02 +0000)
crypto/dso/dso_dlfcn.c

index 558520d55ab4747d5d5da7e3116490be87b2675b..d91e821af6752f58971c0f9dbee6e8d371f4af10 100644 (file)
@@ -237,7 +237,10 @@ static void *dlfcn_bind_var(DSO *dso, const char *symname)
 static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
        {
        void *ptr;
-       DSO_FUNC_TYPE sym, *tsym = &sym;
+       union {
+               DSO_FUNC_TYPE sym;
+               void *dlret;
+       } u;
 
        if((dso == NULL) || (symname == NULL))
                {
@@ -255,14 +258,14 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
                DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE);
                return(NULL);
                }
-       *(void **)(tsym) = dlsym(ptr, symname);
-       if(sym == NULL)
+       u.dlret = dlsym(ptr, symname);
+       if(u.dlret == NULL)
                {
                DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE);
                ERR_add_error_data(4, "symname(", symname, "): ", dlerror());
                return(NULL);
                }
-       return(sym);
+       return u.sym;
        }
 
 static char *dlfcn_merger(DSO *dso, const char *filespec1,