more ENET_SOCKOPT_ERROR fixes

This commit is contained in:
Lee Salzman 2013-08-16 01:18:21 +03:00
parent 3595c0b3fb
commit c0713c47e6
2 changed files with 6 additions and 3 deletions

4
unix.c
View file

@ -275,10 +275,12 @@ int
enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
{
int result = -1;
socklen_t len;
switch (option)
{
case ENET_SOCKOPT_ERROR:
result = getsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, sizeof (int));
len = sizeof (int);
result = getsockopt (socket, SOL_SOCKET, SO_ERROR, value, & len);
break;
default:

View file

@ -204,11 +204,12 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
int
enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
{
int result = SOCKET_ERROR;
int result = SOCKET_ERROR, len;
switch (option)
{
case ENET_SOCKOPT_ERROR:
result = getsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, sizeof (int));
len = sizeof(int);
result = getsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, & len);
break;
default: