[WS2_32_NEW] Properly handle szLocalName. Properly set Hostent on failure. By Peter Hater. CORE-10440

svn path=/trunk/; revision=69807
This commit is contained in:
Amine Khaldi 2015-11-03 22:03:02 +00:00
parent 2ae0399eb9
commit dea5974e8c

View file

@ -220,7 +220,7 @@ gethostbyname(IN const char FAR * name)
INT ErrorCode; INT ErrorCode;
CHAR ResultsBuffer[RNR_BUFFER_SIZE]; CHAR ResultsBuffer[RNR_BUFFER_SIZE];
PCHAR Results = ResultsBuffer; PCHAR Results = ResultsBuffer;
CHAR szLocalName[200]; CHAR szLocalName[MAX_HOSTNAME_LEN];
PCHAR pszName; PCHAR pszName;
PWSPROCESS Process; PWSPROCESS Process;
PWSTHREAD Thread; PWSTHREAD Thread;
@ -238,7 +238,7 @@ gethostbyname(IN const char FAR * name)
if(!name || !*name) if(!name || !*name)
{ {
/* This means we should do a local lookup first */ /* This means we should do a local lookup first */
if(gethostname(szLocalName, 200) != NO_ERROR) return(NULL); if(gethostname(szLocalName, MAX_HOSTNAME_LEN) != NO_ERROR) return(NULL);
pszName = szLocalName; pszName = szLocalName;
} }
else else
@ -277,7 +277,7 @@ gethostbyname(IN const char FAR * name)
else else
{ {
/* We failed, so zero it out */ /* We failed, so zero it out */
Hostent = 0; Hostent = NULL;
/* Normalize the error message */ /* Normalize the error message */
if(GetLastError() == WSASERVICE_NOT_FOUND) if(GetLastError() == WSASERVICE_NOT_FOUND)