mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Fix potential byte order issue
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27046 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ce37b84dd2
commit
62410a883d
1 changed files with 5 additions and 3 deletions
|
@ -1391,6 +1391,8 @@ setNonBlocking(SOCKET fd)
|
|||
port: (int)port
|
||||
family: (int)family
|
||||
{
|
||||
uint16_t p = (uint16_t)port;
|
||||
|
||||
switch (family)
|
||||
{
|
||||
case AF_INET:
|
||||
|
@ -1402,7 +1404,7 @@ setNonBlocking(SOCKET fd)
|
|||
addr_c = [address cStringUsingEncoding: NSUTF8StringEncoding];
|
||||
memset(&peer, '\0', sizeof(peer));
|
||||
peer.sin_family = AF_INET;
|
||||
peer.sin_port = GSSwapHostI16ToBig(port);
|
||||
peer.sin_port = GSSwapHostI16ToBig(p);
|
||||
ptonReturn = inet_pton(AF_INET, addr_c, &peer.sin_addr);
|
||||
if (ptonReturn == 0) // error
|
||||
{
|
||||
|
@ -1425,7 +1427,7 @@ setNonBlocking(SOCKET fd)
|
|||
addr_c = [address cStringUsingEncoding: NSUTF8StringEncoding];
|
||||
memset(&peer, '\0', sizeof(peer));
|
||||
peer.sin6_family = AF_INET6;
|
||||
peer.sin6_port = GSSwapHostI16ToBig(port);
|
||||
peer.sin6_port = GSSwapHostI16ToBig(p);
|
||||
ptonReturn = inet_pton(AF_INET6, addr_c, &peer.sin6_addr);
|
||||
if (ptonReturn == 0) // error
|
||||
{
|
||||
|
@ -1443,7 +1445,7 @@ setNonBlocking(SOCKET fd)
|
|||
case AF_LOCAL:
|
||||
{
|
||||
struct sockaddr_un peer;
|
||||
const char *c_addr;
|
||||
const char *c_addr;
|
||||
|
||||
c_addr = [address fileSystemRepresentation];
|
||||
memset(&peer, '\0', sizeof(peer));
|
||||
|
|
Loading…
Reference in a new issue