* net.cc (load_ipv6_funcs): Use MAX_PATH instead of CYG_MAX_PATH.

(cygwin_getaddrinfo): Simplify formatting.
	(cygwin_getnameinfo): Ditto.
This commit is contained in:
Corinna Vinschen 2007-10-31 16:06:01 +00:00
parent 15346b6950
commit 6eedb2be6d
2 changed files with 95 additions and 91 deletions

View File

@ -1,3 +1,9 @@
2007-10-31 Corinna Vinschen <corinna@vinschen.de>
* net.cc (load_ipv6_funcs): Use MAX_PATH instead of CYG_MAX_PATH.
(cygwin_getaddrinfo): Simplify formatting.
(cygwin_getnameinfo): Ditto.
2007-10-31 Corinna Vinschen <corinna@vinschen.de>
* external.cc (get_cygdrive_info): Make inline.

View File

@ -3833,7 +3833,7 @@ static void
load_ipv6_funcs ()
{
char lib_name[CYG_MAX_PATH];
char lib_name[MAX_PATH];
size_t len;
HMODULE lib;
@ -3841,7 +3841,7 @@ load_ipv6_funcs ()
if (ipv6_inited)
goto out;
WSAGetLastError (); /* Kludge. Enforce WSAStartup call. */
if (GetSystemDirectory (lib_name, CYG_MAX_PATH))
if (GetSystemDirectory (lib_name, MAX_PATH))
{
len = strlen (lib_name);
strcpy (lib_name + len, "\\ws2_32.dll");
@ -3900,8 +3900,9 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
return EAI_NONAME;
}
load_ipv6 ();
if (getaddrinfo)
{
if (!getaddrinfo)
return ipv4_getaddrinfo (hostname, servname, hints, res);
struct addrinfo nhints, *dupres;
/* AI_ADDRCONFIG is not supported prior to Vista. Rather it's
@ -3967,8 +3968,6 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
}
}
return ret;
}
return ipv4_getaddrinfo (hostname, servname, hints, res);
}
extern "C" int
@ -3980,8 +3979,9 @@ cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen,
if (efault.faulted (EFAULT))
return EAI_SYSTEM;
load_ipv6 ();
if (getnameinfo)
{
if (!getnameinfo)
return ipv4_getnameinfo (sa, salen, host, hostlen, serv, servlen, flags);
/* When the incoming port number is set to 0, Winsock's getnameinfo
returns with error WSANO_DATA instead of simply ignoring the port.
To avoid this strange behaviour, we check manually, if the port number
@ -4002,8 +4002,6 @@ cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen,
if (ret)
set_winsock_errno ();
return ret;
}
return ipv4_getnameinfo (sa, salen, host, hostlen, serv, servlen, flags);
}
/* The below function has been taken from OpenBSD's src/sys/netinet6/in6.c. */