From 3595c0b3fb5ebf8a0f10f8d93a94fa12951073eb Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Fri, 16 Aug 2013 00:35:28 +0300 Subject: [PATCH] ENET_SOCKOPT_ERROR fix --- unix.c | 5 ++++- win32.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/unix.c b/unix.c index cfd212e..19585d3 100644 --- a/unix.c +++ b/unix.c @@ -278,7 +278,10 @@ enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value) switch (option) { case ENET_SOCKOPT_ERROR: - result = setsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, sizeof (int)); + result = getsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, sizeof (int)); + break; + + default: break; } return result == -1 ? -1 : 0; diff --git a/win32.c b/win32.c index 1950da9..13d9314 100644 --- a/win32.c +++ b/win32.c @@ -208,7 +208,10 @@ enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value) switch (option) { case ENET_SOCKOPT_ERROR: - result = setsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, sizeof (int)); + result = getsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, sizeof (int)); + break; + + default: break; } return result == SOCKET_ERROR ? -1 : 0;