Add .keep guard files in order to restore lost but empty directories we had with...
[reactos.git] / dll / win32 / ws2_32 / misc / ns.c
index 9c37bbc..9383d4e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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:
@@ -1496,7 +1496,7 @@ inet_addr(IN  CONST CHAR FAR* cp)
 
     p = (PCHAR)cp;
 
-    if (!p || !WSAINITIALIZED)
+    if (!p)
     {
         WSASetLastError(WSAEFAULT);
         return INADDR_NONE;
@@ -1596,6 +1596,7 @@ getaddrinfo(const char FAR * nodename,
     struct addrinfo *ret = NULL, *ai;
     ULONG addr;
     USHORT port;
+    PCHAR pc;
     struct servent *se;
     char *proto;
     LPPROTOENT pent;
@@ -1604,29 +1605,26 @@ getaddrinfo(const char FAR * nodename,
     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)