]> Cypherpunks repositories - gostls13.git/commit
net: fix res_search uses on alpine, android, dragonfly
authorRuss Cox <rsc@golang.org>
Tue, 8 Nov 2022 19:21:27 +0000 (14:21 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 8 Nov 2022 20:59:42 +0000 (20:59 +0000)
commita7538d78214920b798a1914a2a789ae833d6f1e1
tree5d45295960b6ec5c2b845b7cc20457e65c5ad3cd
parent12ab0ac184f45e4fc04ffa77a73e211a0aa86d5f
net: fix res_search uses on alpine, android, dragonfly

On Android and Dragonfly, don't use -lresolv. It doesn't exist there.

On Linux, use res_search instead of res_nsearch.
glibc makes res_search thread-safe by having a per-thread __res.
It still also provides res_nsearch.
musl makes res_search thread-safe by ignoring __res completely.
It does not provide res_nsearch at all.
Changing to res_search on Linux will fix builds on musl-based systems
while keeping glibc-based systems working.

Fixes #56657.
Fixes #56660.

Change-Id: Id87dde6c8bbf6c0d34543c09782f3871489c8712
Reviewed-on: https://go-review.googlesource.com/c/go/+/448797
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/net/cgo_unix_cgo_res.go
src/net/cgo_unix_cgo_resn.go