From a0c0abfff1f209c44763018cdf616c7fe5f16640 Mon Sep 17 00:00:00 2001 From: jilles Date: Fri, 6 Sep 2013 21:02:06 +0000 Subject: 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. --- lib/libc/net/if_nametoindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc/net/if_nametoindex.c') 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)); -- cgit v1.1