mirror of
https://github.com/golang/go
synced 2024-11-17 10:54:50 -07:00
net: report IsNotFound when getnameinfo returns EAI_NONAME
Fixes #57548
Change-Id: I4092624b1e906fbcd520f43aa4bc71c144dea3b6
GitHub-Last-Rev: ab04835947
GitHub-Pull-Request: golang/go#57549
Reviewed-on: https://go-review.googlesource.com/c/go/+/460255
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
780db9a63d
commit
de2efc2aa1
@ -260,17 +260,21 @@ func cgoLookupAddrPTR(addr string, sa *_C_struct_sockaddr, salen _C_socklen_t) (
|
||||
}
|
||||
}
|
||||
if gerrno != 0 {
|
||||
isErrorNoSuchHost := false
|
||||
isTemporary := false
|
||||
switch gerrno {
|
||||
case _C_EAI_SYSTEM:
|
||||
if err == nil { // see golang.org/issue/6232
|
||||
err = syscall.EMFILE
|
||||
}
|
||||
case _C_EAI_NONAME:
|
||||
err = errNoSuchHost
|
||||
isErrorNoSuchHost = true
|
||||
default:
|
||||
err = addrinfoErrno(gerrno)
|
||||
isTemporary = addrinfoErrno(gerrno).Temporary()
|
||||
}
|
||||
return nil, &DNSError{Err: err.Error(), Name: addr, IsTemporary: isTemporary}
|
||||
return nil, &DNSError{Err: err.Error(), Name: addr, IsTemporary: isTemporary, IsNotFound: isErrorNoSuchHost}
|
||||
}
|
||||
for i := 0; i < len(b); i++ {
|
||||
if b[i] == 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user