diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-12-23 14:44:44 +0100 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-12-23 14:44:44 +0100 |
commit | 7c80f67c0c16620e8b0425a129b3dfe72a72aaed (patch) | |
tree | 54ea7d5aad5071ff6012b33ea611ac37032b28b3 /lib/parse.c | |
parent | cce6edeef0e3829fb88185cebf13b21963afe032 (diff) |
Use cast to void * instead of memcpy as Sparc workaround at sockaddr_XXX.
Direct cast results "cast increases required alignment of target type" on
Sparc: use indirect cast to void * instead of memcpy, as Jan Engelhardt
suggested.
Diffstat (limited to 'lib/parse.c')
-rw-r--r-- | lib/parse.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/parse.c b/lib/parse.c index 169d2e0..c4d9c75 100644 --- a/lib/parse.c +++ b/lib/parse.c @@ -634,15 +634,13 @@ get_addrinfo(struct ipset_session *session, continue; if (found == 0) { if (family == AF_INET) { - /* Workaround: cast increases required alignment on Sparc */ - struct sockaddr_in saddr; - memcpy(&saddr, i->ai_addr, sizeof(saddr)); - err = ipset_session_data_set(session, opt, &saddr.sin_addr); + /* Workaround: direct cast increases required alignment on Sparc */ + const struct sockaddr_in *saddr = (void *)i->ai_addr; + err = ipset_session_data_set(session, opt, &saddr->sin_addr); } else { - /* Workaround: cast increases required alignment on Sparc */ - struct sockaddr_in6 saddr; - memcpy(&saddr, i->ai_addr, sizeof(saddr)); - err = ipset_session_data_set(session, opt, &saddr.sin6_addr); + /* Workaround: direct cast increases required alignment on Sparc */ + const struct sockaddr_in6 *saddr = (void *)i->ai_addr; + err = ipset_session_data_set(session, opt, &saddr->sin6_addr); } } else if (found == 1) { ipset_warn(session, |