From c0713c47e664341c16cb46717d6ef031e92ea085 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Fri, 16 Aug 2013 01:18:21 +0300 Subject: [PATCH] more ENET_SOCKOPT_ERROR fixes --- unix.c | 4 +++- win32.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/unix.c b/unix.c index 19585d3..f04bb6d 100644 --- a/unix.c +++ b/unix.c @@ -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: diff --git a/win32.c b/win32.c index 13d9314..057f82c 100644 --- a/win32.c +++ b/win32.c @@ -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: