]> Cypherpunks repositories - gostls13.git/commitdiff
net: accept a few more errors in Accept4 wrapper
authorRuss Cox <rsc@golang.org>
Thu, 3 Apr 2014 20:10:45 +0000 (16:10 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 3 Apr 2014 20:10:45 +0000 (16:10 -0400)
Fixes #7271.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/84170043

src/pkg/net/sock_cloexec.go

index 18ff64388c526d9b1d33326bab48db3ff59ab5c8..dec81855b689bf6678640e482d55d2cec2de58ac 100644 (file)
@@ -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.