diff options
| author | Alexander Barton <alex@barton.de> | 2009-09-14 01:23:19 +0200 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2009-09-14 01:23:19 +0200 |
| commit | 5b1efaee67044b56f6ecac1ee70883bfc61f8c5d (patch) | |
| tree | 8a2e7e22ecb6209233702cbf1ae254326630d0ae /src/ipaddr | |
| parent | d5f80b2a8deda30d0dcd69bea81a3ca862cf46ca (diff) | |
| download | ngircd-5b1efaee67044b56f6ecac1ee70883bfc61f8c5d.tar.gz ngircd-5b1efaee67044b56f6ecac1ee70883bfc61f8c5d.zip | |
Check for sockaddr_in.sin_len and initialize it
Test for sockaddr_in.sin_len and initialize it to the correct value which some systems (notably Mac OS X) require. Note: this code path is only relevant when not using getaddrinfo().
Diffstat (limited to 'src/ipaddr')
| -rw-r--r-- | src/ipaddr/ng_ipaddr.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ipaddr/ng_ipaddr.c b/src/ipaddr/ng_ipaddr.c index 0367a1f7..4f1d4ca4 100644 --- a/src/ipaddr/ng_ipaddr.c +++ b/src/ipaddr/ng_ipaddr.c @@ -51,6 +51,10 @@ ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port) return ret == 0; #else /* HAVE_GETADDRINFO */ assert(ip_str); + memset(addr, 0, sizeof *addr); +#ifdef HAVE_sockaddr_in_len + addr->sin4.sin_len = sizeof(addr->sin4); +#endif addr->sin4.sin_family = AF_INET; # ifdef HAVE_INET_ATON if (inet_aton(ip_str, &addr->sin4.sin_addr) == 0) |