From fc876f22b348202addb9294a6fe8570cdbfa1753 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 1 Feb 2018 15:49:53 +0000 Subject: net: declare lib_getaddrinfo as returning int32 Otherwise on a 64-bit system we will read the 32-bit value as a 64-bit value. Since getaddrinfo returns negative numbers as error values, these will be interpreted as numbers like 0xfffffffe rather than -2, and the comparisons with values like syscall.EAI_NONAME will fail. Fixes golang/go#23645 Reviewed-on: https://go-review.googlesource.com/91296 From-SVN: r257299 --- libgo/go/net/cgo_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libgo') diff --git a/libgo/go/net/cgo_unix.go b/libgo/go/net/cgo_unix.go index 5866d38..5ea13bc 100644 --- a/libgo/go/net/cgo_unix.go +++ b/libgo/go/net/cgo_unix.go @@ -23,7 +23,7 @@ import ( ) //extern getaddrinfo -func libc_getaddrinfo(node *byte, service *byte, hints *syscall.Addrinfo, res **syscall.Addrinfo) int +func libc_getaddrinfo(node *byte, service *byte, hints *syscall.Addrinfo, res **syscall.Addrinfo) int32 //extern freeaddrinfo func libc_freeaddrinfo(res *syscall.Addrinfo) -- cgit v1.1