From d52f1884be4d1204b8f2392bf3f8e995b6a02389 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 29 Jan 2004 11:23:36 +0000 Subject: Dirk Manske fixed a flaw in the setting of the socket to non-blocking --- ares_process.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ares_process.c') diff --git a/ares_process.c b/ares_process.c index ee9623a..b90049e 100644 --- a/ares_process.c +++ b/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); -- cgit v1.2.3