listen: check if AI_ADDRCONFIG is defined

AI_ADDRCONFIG is not available on all operating systems.  Check if it
is defined in the current build environment.
This commit is contained in:
Max Kellermann 2008-12-02 10:23:36 +01:00
parent ac0af91912
commit 6902ff2084

View File

@ -190,7 +190,10 @@ static void parseListenConfigParam(unsigned int port, ConfigParam * param)
DEBUG("binding to address for %s\n", param->value); DEBUG("binding to address for %s\n", param->value);
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; hints.ai_flags = AI_PASSIVE;
#ifdef AI_ADDRCONFIG
hints.ai_flags |= AI_ADDRCONFIG;
#endif
hints.ai_family = PF_UNSPEC; hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP; hints.ai_protocol = IPPROTO_TCP;