Author: rharabien
Date: Thu Dec 8 19:21:01 2011
New Revision: 54615
URL:
http://svn.reactos.org/svn/reactos?rev=54615&view=rev
Log:
[WS2_32] - Use size of struct instead of size of pointer. Don't copy szProtocol,
because it's set later. CID 14129 and 54.
Modified:
trunk/reactos/dll/win32/ws2_32/misc/ns.c
Modified: trunk/reactos/dll/win32/ws2_32/misc/ns.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/misc/ns.c…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] Thu Dec 8 19:21:01 2011
@@ -401,7 +401,7 @@
memcpy(lpProtoInfoW,
lpProtocolInfo,
- sizeof(LPWSAPROTOCOL_INFOA));
+ FIELD_OFFSET(WSAPROTOCOL_INFOA, szProtocol));
MultiByteToWideChar(CP_ACP,
0,
@@ -427,7 +427,7 @@
lpProtoInfoW);
WSASetLastError(ret);
- return ret;
+ return ret;
}
@@ -459,9 +459,9 @@
/* Set right adress family */
if (lpProtocolInfo!=NULL)
- sockaddr->sin_family = lpProtocolInfo->iAddressFamily;
-
- else sockaddr->sin_family = AddressFamily;
+ sockaddr->sin_family = lpProtocolInfo->iAddressFamily;
+ else
+ sockaddr->sin_family = AddressFamily;
/* Report size */
if (AddressFamily == AF_INET)
@@ -513,7 +513,7 @@
WSASetLastError(res);
if (!res) return 0;
- return SOCKET_ERROR;
+ return SOCKET_ERROR;
}
void check_hostent(struct hostent **he)
@@ -923,13 +923,12 @@
if(name == NULL)
{
ret = gethostname(p->Hostent->h_name, MAX_HOSTNAME_LEN);
+ if(ret)
+ {
+ WSASetLastError( WSAHOST_NOT_FOUND ); //WSANO_DATA ??
+ return NULL;
+ }
return p->Hostent;
- }
-
- if(ret)
- {
- WSASetLastError( WSAHOST_NOT_FOUND ); //WSANO_DATA ??
- return NULL;
}
/* Is it an IPv6 address? */