From 3a35544dd94b1667e429a0f6095920b04f14dc77 Mon Sep 17 00:00:00 2001 From: Rein Klazes Date: Tue, 2 Sep 2003 18:12:20 +0000 Subject: [PATCH] _ws_gethostbyname() and WSAAsyncGetHostByName() when called with a null name, should use the name returned by gethostname(). --- dlls/winsock/async.c | 10 ++++++++++ dlls/winsock/socket.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/dlls/winsock/async.c b/dlls/winsock/async.c index 2271e234c19..33b43d86d8f 100644 --- a/dlls/winsock/async.c +++ b/dlls/winsock/async.c @@ -402,6 +402,16 @@ static DWORD WINAPI _async_queryfun(LPVOID arg) { int ebufsize=1024; struct hostent hostentry; int locerr = ENOBUFS; +#endif + char buf[100]; + if( !(aq->host_name)) { + aq->host_name = buf; + if( gethostname( buf, 100) == -1) { + fail = WSAENOBUFS; /* appropriate ? */ + break; + } + } +#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6 he = NULL; extrabuf=HeapAlloc(GetProcessHeap(),0,ebufsize) ; while(extrabuf) { diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c index 757f4948ccf..8f275735bfd 100644 --- a/dlls/winsock/socket.c +++ b/dlls/winsock/socket.c @@ -2903,6 +2903,16 @@ static WIN_hostent * __ws_gethostbyname(const char *name, int dup_flag) int ebufsize=1024; struct hostent hostentry; int locerr = ENOBUFS; +#endif + char buf[100]; + if( !name) { + name = buf; + if( gethostname( buf, 100) == -1) { + SetLastError( WSAENOBUFS); /* appropriate ? */ + return retval; + } + } +#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6 host = NULL; extrabuf=HeapAlloc(GetProcessHeap(),0,ebufsize) ; while(extrabuf) { -- 2.11.4.GIT