Skip to content

Commit

Permalink
protect AI_ALL and AI_V4MAPPED macros to enable compiling for very
Browse files Browse the repository at this point in the history
old windows versions such as XP
  • Loading branch information
millerpuckette committed May 28, 2020
1 parent 99e0d1c commit e42570d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/s_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ int addrinfo_get_list(struct addrinfo **ailist, const char *hostname,
hints.ai_family = AF_UNSPEC; /* IPv4 or IPv6 */
hints.ai_socktype = protocol;
hints.ai_protocol = (protocol == SOCK_STREAM ? IPPROTO_TCP : IPPROTO_UDP);
hints.ai_flags = AI_ALL | /* both IPv4 and IPv6 addrs */
hints.ai_flags =
#ifdef AI_ALL
AI_ALL | /* both IPv4 and IPv6 addrs */
#endif
#ifdef AI_V4MAPPED
AI_V4MAPPED | /* fallback to IPv4-mapped IPv6 addrs */
#endif
AI_PASSIVE; /* listen to any addr if hostname is NULL */
portstr[0] = '\0';
sprintf(portstr, "%d", port);
Expand Down

0 comments on commit e42570d

Please sign in to comment.