ws2_32: Fix edge case for getaddrinfo in BSD and OSX.

This commit is contained in:
Bruno Jesus 2014-02-14 08:44:21 -02:00 committed by Alexandre Julliard
parent 5425cb3413
commit da16d6b660
2 changed files with 27 additions and 0 deletions

View File

@ -5466,6 +5466,9 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
else
node = nodename;
/* servname tweak required by OSX and BSD kernels */
if (servname && !servname[0]) servname = "0";
if (hints) {
punixhints = &unixhints;

View File

@ -5401,12 +5401,24 @@ static void test_GetAddrInfoW(void)
ok(result != NULL, "GetAddrInfoW failed\n");
pFreeAddrInfoW(result);
result = NULL;
ret = pGetAddrInfoW(NULL, empty, NULL, &result);
ok(!ret, "GetAddrInfoW failed with %d\n", WSAGetLastError());
ok(result != NULL, "GetAddrInfoW failed\n");
pFreeAddrInfoW(result);
result = NULL;
ret = pGetAddrInfoW(empty, zero, NULL, &result);
ok(!ret, "GetAddrInfoW failed with %d\n", WSAGetLastError());
ok(result != NULL, "GetAddrInfoW failed\n");
pFreeAddrInfoW(result);
result = NULL;
ret = pGetAddrInfoW(empty, empty, NULL, &result);
ok(!ret, "GetAddrInfoW failed with %d\n", WSAGetLastError());
ok(result != NULL, "GetAddrInfoW failed\n");
pFreeAddrInfoW(result);
result = NULL;
ret = pGetAddrInfoW(localhost, NULL, NULL, &result);
ok(!ret, "GetAddrInfoW failed with %d\n", WSAGetLastError());
@ -5528,12 +5540,24 @@ static void test_getaddrinfo(void)
ok(result != NULL, "getaddrinfo failed\n");
pfreeaddrinfo(result);
result = NULL;
ret = pgetaddrinfo(NULL, "", NULL, &result);
ok(!ret, "getaddrinfo failed with %d\n", WSAGetLastError());
ok(result != NULL, "getaddrinfo failed\n");
pfreeaddrinfo(result);
result = NULL;
ret = pgetaddrinfo("", "0", NULL, &result);
ok(!ret, "getaddrinfo failed with %d\n", WSAGetLastError());
ok(result != NULL, "getaddrinfo failed\n");
pfreeaddrinfo(result);
result = NULL;
ret = pgetaddrinfo("", "", NULL, &result);
ok(!ret, "getaddrinfo failed with %d\n", WSAGetLastError());
ok(result != NULL, "getaddrinfo failed\n");
pfreeaddrinfo(result);
result = NULL;
ret = pgetaddrinfo("localhost", NULL, NULL, &result);
ok(!ret, "getaddrinfo failed with %d\n", WSAGetLastError());