diff options
author | tnn <tnn@pkgsrc.org> | 2009-08-06 14:02:38 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2009-08-06 14:02:38 +0000 |
commit | 5da5d5a9fccb24f3845cff24268ae1513e226923 (patch) | |
tree | 699732a42aa717db1a255558085bfcd4578bd1c4 /net/rbldnsd | |
parent | e207841ddfcdb0a86451aa1e82c0db77084ad6ca (diff) | |
download | pkgsrc-5da5d5a9fccb24f3845cff24268ae1513e226923.tar.gz |
Fix strict aliasing issue which GCC 4.4 complained about.
While we know that "struct sockaddr_storage" has been engineered to alias
to all the sockaddr structs, the compiler does not know about this.
Thus, code like this may be unsafe to use:
struct sockaddr_storage ss;
struct sockaddr_in *sin = &ss;
sin->sin_port = 0; /* dereferencing here breaks ISO C aliasing rules */
A workaround is to wrap the struct in a union, e.g:
union anonymous {
struct sockaddr_storage ss;
struct sockaddr_in sin;
} u;
u.sin.sin_port = 0;
--
Approved by: joerg
Diffstat (limited to 'net/rbldnsd')
0 files changed, 0 insertions, 0 deletions