summaryrefslogtreecommitdiff
path: root/ares/ares_process.c
diff options
context:
space:
mode:
Diffstat (limited to 'ares/ares_process.c')
-rw-r--r--ares/ares_process.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ares/ares_process.c b/ares/ares_process.c
index ee9623ac5..b90049e60 100644
--- a/ares/ares_process.c
+++ b/ares/ares_process.c
@@ -464,12 +464,14 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server)
flags = 1;
ioctlsocket(s, FIONBIO, &flags);
#else
- if (fcntl(s, F_GETFL, &flags) == -1)
+ flags = fcntl(s, F_GETFL, 0);
+
+ if (flags == -1)
{
close(s);
return -1;
}
- flags &= O_NONBLOCK;
+ flags |= O_NONBLOCK;
if (fcntl(s, F_SETFL, flags) == -1)
{
close(s);