From: Ian Lance Taylor Date: Wed, 30 Aug 2023 18:28:54 +0000 (-0700) Subject: os/user: use correct size for initial call in retryWithBuffer X-Git-Tag: go1.22rc1~1025 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9aaf5234bf652fc788782fc04a06044879b5957a;p=gostls13.git 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 --- 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 {