Commit f05c8b48 authored by Ian Lance Taylor's avatar Ian Lance Taylor

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 <iant@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 86cca11f
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
// general. Unfortunately, we need to run on kernels built without // general. Unfortunately, we need to run on kernels built without
// IPv6 support too. So probe the kernel to figure it out. // IPv6 support too. So probe the kernel to figure it out.
func (p *ipStackCapabilities) probe() { 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 { switch err {
case syscall.EAFNOSUPPORT, syscall.EPROTONOSUPPORT: case syscall.EAFNOSUPPORT, syscall.EPROTONOSUPPORT:
case nil: case nil:
...@@ -48,7 +48,7 @@ func (p *ipStackCapabilities) probe() { ...@@ -48,7 +48,7 @@ func (p *ipStackCapabilities) probe() {
probes = probes[:1] probes = probes[:1]
} }
for i := range probes { 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 { if err != nil {
continue continue
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment