1
0
mirror of https://github.com/golang/go synced 2024-11-18 22:24:50 -07:00

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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Ian Lance Taylor 2023-08-30 11:28:54 -07:00 committed by Gopher Robot
parent 71a0beb68d
commit 9aaf5234bf

View File

@ -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 {