From: Daniel Stenberg Date: Thu, 29 Jan 2004 11:23:36 +0000 (+0000) Subject: Dirk Manske fixed a flaw in the setting of the socket to non-blocking X-Git-Tag: upstream/1.10.0~1519 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d52f1884be4d1204b8f2392bf3f8e995b6a02389;p=platform%2Fupstream%2Fc-ares.git Dirk Manske fixed a flaw in the setting of the socket to non-blocking --- diff --git a/CHANGES b/CHANGES index 14c806c..d01629f 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,10 @@ doesn't want these improvements. The package is called 'c-ares' for now since I (Daniel Stenberg) want this for use within the curl project (hence the letter C) and it makes a nice pun. +* January 29, 2004: + +- Dirk Manske fixed how the socket is set non-blocking. + * January 4, 2004: - Dominick Meglio made the private gettimeofday() become ares_gettimeofday() 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);