1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-10-17 07:37:39 +00:00

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().
This commit is contained in:
Alexander Barton
2009-09-14 01:23:19 +02:00
parent d5f80b2a8d
commit 5b1efaee67
2 changed files with 9 additions and 1 deletions

View File

@@ -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)