diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-01-29 11:23:36 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-01-29 11:23:36 +0000 |
commit | d52f1884be4d1204b8f2392bf3f8e995b6a02389 (patch) | |
tree | 54838b6fdefb052ca0b9da3d28ea84ead449f227 /ares_process.c | |
parent | d49a450fcefea59c062fa52d835bcdaca305b4ce (diff) | |
download | c-ares-d52f1884be4d1204b8f2392bf3f8e995b6a02389.tar.gz c-ares-d52f1884be4d1204b8f2392bf3f8e995b6a02389.tar.bz2 c-ares-d52f1884be4d1204b8f2392bf3f8e995b6a02389.zip |
Dirk Manske fixed a flaw in the setting of the socket to non-blocking
Diffstat (limited to 'ares_process.c')
-rw-r--r-- | ares_process.c | 6 |
1 files changed, 4 insertions, 2 deletions
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); |