From 1ec75fc582a40a17867dd6c16005a3751661c52a Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Mon, 12 Mar 2007 19:18:16 +0000 Subject: [PATCH] - Always use AI_NUMERICSERV since we cannot use service names in LibVLC - Only pass used ai_flags so we won't break if broken IETF draft draft-chakrabarti-ipv6-addrselect-api-05 makes it to standard --- src/network/getaddrinfo.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c index 70183d6b14..aa275eba96 100644 --- a/src/network/getaddrinfo.c +++ b/src/network/getaddrinfo.c @@ -589,10 +589,16 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node, snprintf( psz_service, 6, "%d", i_port ); /* Check if we have to force ipv4 or ipv6 */ - if( p_hints == NULL ) - memset( &hints, 0, sizeof( hints ) ); - else - memcpy( &hints, p_hints, sizeof( hints ) ); + memset (&hints, 0, sizeof (hints)); + if (p_hints != NULL) + { + hints.ai_family = p_hints->ai_family; + hints.ai_socktype = p_hints->ai_socktype; + hints.ai_protocol = p_hints->ai_protocol; + hints.ai_flags = p_hints->ai_flags & (AI_NUMERICHOST|AI_PASSIVE); + } + /* we only ever use port *numbers* */ + hints.ai_flags |= AI_NUMERICSERV; if( hints.ai_family == AF_UNSPEC ) { -- 2.39.5