]> Cypherpunks repositories - gostls13.git/commit
os/user: fix buffer retry loop on macOS
authorRuss Cox <rsc@golang.org>
Wed, 7 Dec 2022 14:18:11 +0000 (09:18 -0500)
committerGopher Robot <gobot@golang.org>
Wed, 7 Dec 2022 16:09:09 +0000 (16:09 +0000)
commit7ed50cfd09ba3d51c673fc782c6ad2b715a46bc2
tree5eabbd313e552a8197bd3f442b1b595e982c9d8a
parenta4a86c7b2441d2777beb2377acfa3d9d7b1fc4ee
os/user: fix buffer retry loop on macOS

getpwnam_r and friends return the errno as the result,
not in the global errno. The code changes in CL 449316
inadvertently started using the global errno.
So if a lookup didn't fit in the first buffer size,
it was treated as not found instead of growing the buffer.

Fixes #56942.

Change-Id: Ic5904fbeb31161bccd858e5adb987e919fb3e9d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/455815
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
src/internal/syscall/unix/user_darwin.go
src/os/user/cgo_lookup_unix.go
src/os/user/lookup_plan9.go
src/os/user/lookup_stubs.go
src/os/user/lookup_windows.go
src/os/user/user_test.go