summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/if_nametoindex.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-09-06 21:02:06 +0000
committerjilles <jilles@FreeBSD.org>2013-09-06 21:02:06 +0000
commita0c0abfff1f209c44763018cdf616c7fe5f16640 (patch)
treecc3e6c5d69e4d0eee1e3bcb2c052aeb0be9035c8 /lib/libc/net/if_nametoindex.c
parent015eb27a8b0450258dd29fd9db494e07060a4a45 (diff)
downloadFreeBSD-src-a0c0abfff1f209c44763018cdf616c7fe5f16640.zip
FreeBSD-src-a0c0abfff1f209c44763018cdf616c7fe5f16640.tar.gz
libc: Use SOCK_CLOEXEC for various internal file descriptors.
This change avoids undesirably passing some internal file descriptors to a process created (fork+exec) by another thread. Kernel support for SOCK_CLOEXEC was added in r248534, March 19, 2013.
Diffstat (limited to 'lib/libc/net/if_nametoindex.c')
-rw-r--r--lib/libc/net/if_nametoindex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/net/if_nametoindex.c b/lib/libc/net/if_nametoindex.c
index 89076c0..8f04921 100644
--- a/lib/libc/net/if_nametoindex.c
+++ b/lib/libc/net/if_nametoindex.c
@@ -68,7 +68,7 @@ if_nametoindex(const char *ifname)
struct ifaddrs *ifaddrs, *ifa;
unsigned int ni;
- s = _socket(AF_INET, SOCK_DGRAM, 0);
+ s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (s != -1) {
#ifdef PURIFY
memset(&ifr, 0, sizeof(ifr));
OpenPOWER on IntegriCloud