ws2_32: gethostbyname("") should work.

This commit is contained in:
Damjan Jovanovic 2007-06-01 09:13:19 +02:00 committed by Alexandre Julliard
parent cb029e0b30
commit b23d90a543
2 changed files with 10 additions and 1 deletions

View File

@ -3222,7 +3222,7 @@ struct WS_hostent* WINAPI WS_gethostbyname(const char* name)
int locerr = ENOBUFS;
#endif
char buf[100];
if( !name) {
if( !name || !name[0]) {
name = buf;
if( gethostname( buf, 100) == -1) {
SetLastError( WSAENOBUFS); /* appropriate ? */

View File

@ -1665,6 +1665,14 @@ static void test_getsockname(void)
WSACleanup();
}
static void test_dns(void)
{
struct hostent *h;
h = gethostbyname("");
ok(h != NULL, "gethostbyname(\"\") failed with %d\n", h_errno);
}
static void test_inet_addr(void)
{
u_long addr;
@ -1850,6 +1858,7 @@ START_TEST( sock )
test_accept();
test_getsockname();
test_inet_addr();
test_dns();
test_send();
test_write_events();