aboutsummaryrefslogtreecommitdiffhomepage
path: root/unix.c
diff options
context:
space:
mode:
authorLee Salzman <[email protected]>2014-12-31 00:24:29 +0200
committerLee Salzman <[email protected]>2014-12-31 00:24:29 +0200
commit4d2694d74eb56ea83ad83be56c824b3ac845a507 (patch)
tree59b27ea87f631b92339713850a030b8b56f0f012 /unix.c
parentc8fa0aeea46d8ac00b2402f5ab7f09770837124a (diff)
downloadenet-4d2694d74eb56ea83ad83be56c824b3ac845a507.tar.gz
enet-4d2694d74eb56ea83ad83be56c824b3ac845a507.zip
fix ENET_SOCKOPT_NONBLOCK when value is 0
Diffstat (limited to 'unix.c')
-rw-r--r--unix.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/unix.c b/unix.c
index 5e7c731..431d19c 100644
--- a/unix.c
+++ b/unix.c
@@ -246,7 +246,7 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
{
case ENET_SOCKOPT_NONBLOCK:
#ifdef HAS_FCNTL
- result = fcntl (socket, F_SETFL, O_NONBLOCK | fcntl (socket, F_GETFL));
+ result = fcntl (socket, F_SETFL, (value ? O_NONBLOCK : 0) | (fcntl (socket, F_GETFL) & ~O_NONBLOCK));
#else
result = ioctl (socket, FIONBIO, & value);
#endif