summaryrefslogtreecommitdiff
path: root/ares_process.c
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 20:57:52 (GMT)
committerPhilippe Coval <philippe.coval@open.eurogiciel.org>2014-12-08 12:26:59 (GMT)
commit1c9d586a6b1540b79602ac48109d1e8c2e74c68e (patch)
tree49d113f6bbf289a09edc26849dfe24af4f6cfeb5 /ares_process.c
parent46fa9cad7984cb632c9f8776297fe4a86e19e0d8 (diff)
downloadc-ares-1c9d586a6b1540b79602ac48109d1e8c2e74c68e.zip
c-ares-1c9d586a6b1540b79602ac48109d1e8c2e74c68e.tar.gz
c-ares-1c9d586a6b1540b79602ac48109d1e8c2e74c68e.tar.bz2
downstream: ocloexec
Change-Id: Ie10c7a5414603781405af5b7a094c9cc359e2465 Author: Anas Nashif <anas.nashif@intel.com>
Diffstat (limited to 'ares_process.c')
-rw-r--r--ares_process.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ares_process.c b/ares_process.c
index bbeca5e..4d7dcd3 100644
--- a/ares_process.c
+++ b/ares_process.c
@@ -915,7 +915,7 @@ static int configure_socket(ares_socket_t s, int family, ares_channel channel)
setsocknonblock(s, TRUE);
-#if defined(FD_CLOEXEC) && !defined(MSDOS)
+#if !defined(SOCK_CLOEXEC) && defined(FD_CLOEXEC) && !defined(MSDOS)
/* Configure the socket fd as close-on-exec. */
if (fcntl(s, F_SETFD, FD_CLOEXEC) == -1)
return -1;
@@ -1004,7 +1004,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server)
}
/* Acquire a socket. */
- s = socket(server->addr.family, SOCK_STREAM, 0);
+ s = socket(server->addr.family, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (s == ARES_SOCKET_BAD)
return -1;
@@ -1096,7 +1096,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server)
}
/* Acquire a socket. */
- s = socket(server->addr.family, SOCK_DGRAM, 0);
+ s = socket(server->addr.family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (s == ARES_SOCKET_BAD)
return -1;