From f05c8b48ea2d249965418e76c9151a3d6bde7ed9 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 3 Jan 2018 12:59:09 -0800 Subject: [PATCH] net: set CLOEXEC on sockets used for capability probes Fixes #22349 Change-Id: I84ec4fa9fa95bac0f26bf4ca3e62a35dff4f7e00 Reviewed-on: https://go-review.googlesource.com/86015 Run-TryBot: Ian Lance Taylor Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/net/ipsock_posix.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/ipsock_posix.go b/src/net/ipsock_posix.go index d659bf063a1..8372aaa7423 100644 --- a/src/net/ipsock_posix.go +++ b/src/net/ipsock_posix.go @@ -24,7 +24,7 @@ import ( // general. Unfortunately, we need to run on kernels built without // IPv6 support too. So probe the kernel to figure it out. func (p *ipStackCapabilities) probe() { - s, err := socketFunc(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_TCP) + s, err := sysSocket(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_TCP) switch err { case syscall.EAFNOSUPPORT, syscall.EPROTONOSUPPORT: case nil: @@ -48,7 +48,7 @@ func (p *ipStackCapabilities) probe() { probes = probes[:1] } for i := range probes { - s, err := socketFunc(syscall.AF_INET6, syscall.SOCK_STREAM, syscall.IPPROTO_TCP) + s, err := sysSocket(syscall.AF_INET6, syscall.SOCK_STREAM, syscall.IPPROTO_TCP) if err != nil { continue }