diff options
author | Marc Hoersken <info@marc-hoersken.de> | 2012-06-26 07:27:02 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2012-06-26 21:24:29 +0200 |
commit | a8478fc8d3ee5ca8ad6264b18ca2896298c33a65 (patch) | |
tree | 94b49753c94aa2ca7bcafb746a97d6bed3a802c5 /lib/sockaddr.h | |
parent | 849179ba2739ab9a0ad079384b125d9c1745db5f (diff) | |
download | curl-a8478fc8d3ee5ca8ad6264b18ca2896298c33a65.tar.gz |
sockaddr.h: Fixed dereferencing pointer breakin strict-aliasing
Fixed warning: dereferencing pointer does break strict-aliasing rules
by using a union inside the struct Curl_sockaddr_storage declaration.
Diffstat (limited to 'lib/sockaddr.h')
-rw-r--r-- | lib/sockaddr.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/sockaddr.h b/lib/sockaddr.h index c69411b52..440eb0a97 100644 --- a/lib/sockaddr.h +++ b/lib/sockaddr.h @@ -24,14 +24,19 @@ #include "setup.h" -#ifdef HAVE_STRUCT_SOCKADDR_STORAGE struct Curl_sockaddr_storage { - struct sockaddr_storage buffer; -}; + union { + struct sockaddr sa; + struct sockaddr_in sa_in; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 sa_in6; +#endif +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + struct sockaddr_storage sa_stor; #else -struct Curl_sockaddr_storage { - char buffer[256]; /* this should be big enough to fit a lot */ -}; + char cbuf[256]; /* this should be big enough to fit a lot */ #endif + } buffer; +}; #endif /* __SOCKADDR_H */ |