diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-17 05:53:37 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:50:44 +0100 |
commit | 70cea01a9ec0be4ef9fd141a16b52e8141a1c94a (patch) | |
tree | 42d60afac6d684e0fe4180a390eff6bf5dadd98f /source4/lib/replace/getifaddrs.c | |
parent | b1cd9c39c3465dff1e94241779c643a28d008ce8 (diff) | |
download | samba-70cea01a9ec0be4ef9fd141a16b52e8141a1c94a.tar.gz samba-70cea01a9ec0be4ef9fd141a16b52e8141a1c94a.tar.bz2 samba-70cea01a9ec0be4ef9fd141a16b52e8141a1c94a.zip |
r26487: Cope with systems that don't have struct sockaddr.sa_len.
(This used to be commit 56080469ab28ae5a2f456cced34814d9c33480c6)
Diffstat (limited to 'source4/lib/replace/getifaddrs.c')
-rw-r--r-- | source4/lib/replace/getifaddrs.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index e04c023209..b681a8649c 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -53,10 +53,17 @@ void freeifaddrs(struct ifaddrs *ifp) struct sockaddr *sockaddr_dup(struct sockaddr *sa) { - struct sockaddr *ret = calloc(1, sa->sa_len); + struct sockaddr *ret; + socklen_t socklen; +#ifdef HAVE_SOCKADDR_SA_LEN + socklen = sa->sa_len; +#else + socklen = sizeof(struct sockaddr_storage); +#endif + ret = = calloc(1, socklen); if (ret == NULL) return NULL; - memcpy(ret, sa, sa->sa_len); + memcpy(ret, sa, socklen); return ret; } #endif |