From: Russ Cox Date: Thu, 3 Apr 2014 20:10:45 +0000 (-0400) Subject: net: accept a few more errors in Accept4 wrapper X-Git-Tag: go1.3beta1~200 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5fb39cc6a2621602d33c6b226742795318a279ea;p=gostls13.git net: accept a few more errors in Accept4 wrapper Fixes #7271. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/84170043 --- diff --git a/src/pkg/net/sock_cloexec.go b/src/pkg/net/sock_cloexec.go index 18ff64388c..dec81855b6 100644 --- a/src/pkg/net/sock_cloexec.go +++ b/src/pkg/net/sock_cloexec.go @@ -49,8 +49,13 @@ func accept(s int) (int, syscall.Sockaddr, error) { // kernel and on FreeBSD it was introduced in 10 kernel. If we // get an ENOSYS error on both Linux and FreeBSD, or EINVAL // error on Linux, fall back to using accept. - if err == nil || (err != syscall.ENOSYS && err != syscall.EINVAL) { + switch err { + default: // nil and errors other than the ones listed return ns, sa, err + case syscall.ENOSYS: // syscall missing + case syscall.EINVAL: // some Linux use this instead of ENOSYS + case syscall.EACCES: // some Linux use this instead of ENOSYS + case syscall.EFAULT: // some Linux use this instead of ENOSYS } // See ../syscall/exec_unix.go for description of ForkLock.