From 9aaf5234bf652fc788782fc04a06044879b5957a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 30 Aug 2023 11:28:54 -0700 Subject: [PATCH] os/user: use correct size for initial call in retryWithBuffer We were accidentally using the sysconf parameter constant. Change to using the value of that sysconf parameter. Change-Id: Id7668e7cced0ce7504df99dbbff0757d29dee8c8 Reviewed-on: https://go-review.googlesource.com/c/go/+/524555 LUCI-TryBot-Result: Go LUCI Auto-Submit: Ian Lance Taylor Reviewed-by: Russ Cox Reviewed-by: Ian Lance Taylor --- src/os/user/cgo_lookup_unix.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/user/cgo_lookup_unix.go b/src/os/user/cgo_lookup_unix.go index 3735971eb4..402429ba4a 100644 --- a/src/os/user/cgo_lookup_unix.go +++ b/src/os/user/cgo_lookup_unix.go @@ -165,8 +165,8 @@ func (k bufferKind) initialSize() _C_size_t { // retryWithBuffer repeatedly calls f(), increasing the size of the // buffer each time, until f succeeds, fails with a non-ERANGE error, // or the buffer exceeds a reasonable limit. -func retryWithBuffer(startSize bufferKind, f func([]byte) syscall.Errno) error { - buf := make([]byte, startSize) +func retryWithBuffer(kind bufferKind, f func([]byte) syscall.Errno) error { + buf := make([]byte, kind.initialSize()) for { errno := f(buf) if errno == 0 { -- 2.50.0