aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-01-29 11:23:36 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-01-29 11:23:36 +0000
commit663d2080d14715602674f0afc2bd85b1438152d4 (patch)
tree581ce4ad95edc737d42761962d4d2c2dad48c392
parente5641a33bb037de1902ec5aef980f2c97ddfd1e8 (diff)
Dirk Manske fixed a flaw in the setting of the socket to non-blocking
-rw-r--r--ares/CHANGES4
-rw-r--r--ares/ares_process.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/ares/CHANGES b/ares/CHANGES
index 14c806c6a..d01629fbf 100644
--- a/ares/CHANGES
+++ b/ares/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/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);