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 | 663d2080d14715602674f0afc2bd85b1438152d4 (patch) | |
tree | 581ce4ad95edc737d42761962d4d2c2dad48c392 /ares/ares_process.c | |
parent | e5641a33bb037de1902ec5aef980f2c97ddfd1e8 (diff) |
Dirk Manske fixed a flaw in the setting of the socket to non-blocking
Diffstat (limited to 'ares/ares_process.c')
-rw-r--r-- | ares/ares_process.c | 6 |
1 files changed, 4 insertions, 2 deletions
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); |