blob: 48ba01b6f45101ba59f8715d98687fcf54f96201 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
--- a/src/pkg/os/user/lookup_unix.go
+++ b/src/pkg/os/user/lookup_unix.go
@@ -57,6 +57,12 @@
bufSize = 1024
} else {
bufSize = C.sysconf(C._SC_GETPW_R_SIZE_MAX)
+ // The musl alternative standard library on Linux
+ // return -1 as specified by POSIX if there are no
+ // hard limit on _SC_GETPW_R_SIZE_MAX.
+ if bufSize == -1 {
+ bufSize = 1024
+ }
if bufSize <= 0 || bufSize > 1<<20 {
return nil, fmt.Errorf("user: unreasonable _SC_GETPW_R_SIZE_MAX of %d", bufSize)
}
|