From 65025fea2ca3c0e2c1dc8bcf8aad4f4bfbbf3c43 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 9 Mar 2017 13:35:04 -0500 Subject: [PATCH] [socket] ret might not have been initialized (#4495) --- mono/metadata/w32socket-unix.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mono/metadata/w32socket-unix.c b/mono/metadata/w32socket-unix.c index c10b2100368..f0139c31818 100644 --- a/mono/metadata/w32socket-unix.c +++ b/mono/metadata/w32socket-unix.c @@ -1134,6 +1134,7 @@ mono_w32socket_close (SOCKET sock) gint mono_w32socket_set_blocking (SOCKET socket, gboolean blocking) { +#ifdef O_NONBLOCK gint ret; gpointer handle; @@ -1143,14 +1144,12 @@ mono_w32socket_set_blocking (SOCKET socket, gboolean blocking) return SOCKET_ERROR; } -#ifdef O_NONBLOCK /* This works better than ioctl(...FIONBIO...) * on Linux (it causes connect to return * EINPROGRESS, but the ioctl doesn't seem to) */ ret = fcntl (socket, F_GETFL, 0); if (ret != -1) ret = fcntl (socket, F_SETFL, blocking ? (ret & (~O_NONBLOCK)) : (ret | (O_NONBLOCK))); -#endif /* O_NONBLOCK */ if (ret == -1) { gint errnum = errno; @@ -1160,6 +1159,10 @@ mono_w32socket_set_blocking (SOCKET socket, gboolean blocking) } return 0; +#else + mono_w32socket_set_last_error (ERROR_NOT_SUPPORTED); + return SOCKET_ERROR; +#endif /* O_NONBLOCK */ } gint -- 2.25.1