Dirk Manske fixed a flaw in the setting of the socket to non-blocking
authorDaniel Stenberg <daniel@haxx.se>
Thu, 29 Jan 2004 11:23:36 +0000 (11:23 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 29 Jan 2004 11:23:36 +0000 (11:23 +0000)
CHANGES
ares_process.c

diff --git a/CHANGES b/CHANGES
index 14c806c6af5e3859193afb66f52941f5d3c69319..d01629fbf2c834e4f6b5491f64cdb1dce1cb466b 100644 (file)
--- 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()
index ee9623ac5a297b46570360f1b0d1ffc25366f533..b90049e605d1cf9cd0b5b07684a5e057161a1376 100644 (file)
@@ -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);