/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS WinSock 2 DLL
- * FILE: misc/ns.c
+ * FILE: dll/win32/ws2_32/misc/ns.c
* PURPOSE: Namespace APIs
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* REVISIONS:
p = (PCHAR)cp;
- if (!p || !WSAINITIALIZED)
+ if (!p)
{
WSASetLastError(WSAEFAULT);
return INADDR_NONE;
struct addrinfo *ret = NULL, *ai;
ULONG addr;
USHORT port;
+ PCHAR pc;
struct servent *se;
char *proto;
LPPROTOENT pent;
struct sockaddr_in *sin;
INT error;
- if (res == NULL)
+ if (!WSAINITIALIZED)
{
- error = WSAEINVAL;
+ error = WSANOTINITIALISED;
goto End;
}
+
+ *res = NULL;
+
if (nodename == NULL && servname == NULL)
{
error = WSAHOST_NOT_FOUND;
goto End;
}
- if (!WSAINITIALIZED)
- {
- error = WSANOTINITIALISED;
- goto End;
- }
-
if (servname)
{
/* converting port number */
- port = strtoul(servname, NULL, 10);
+ port = strtoul(servname, &pc, 10);
/* service name was specified? */
- if (port == 0)
+ if (*pc != ANSI_NULL)
{
/* protocol was specified? */
if (hints && hints->ai_protocol)