1
0
mirror of https://github.com/golang/go synced 2024-11-19 01:14:39 -07:00

os/user: wrap getgrnam_r to fix type issues

Even with -D_POSIX_PTHREAD_SEMANTICS, Solaris seems to not define
getgrnam_r in a POSIX compatible way.

Fixes #14967

Change-Id: I78cb7e5b30b2d8b860e336060a0a06f4720c0475
Reviewed-on: https://go-review.googlesource.com/21385
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ross Light 2016-03-31 14:57:49 -07:00 committed by Brad Fitzpatrick
parent b2fc9f1c23
commit 530e216494

View File

@ -37,6 +37,11 @@ static int mygetgrgid_r(int gid, struct group *grp,
char *buf, size_t buflen, struct group **result) {
return getgrgid_r(gid, grp, buf, buflen, result);
}
static int mygetgrnam_r(const char *name, struct group *grp,
char *buf, size_t buflen, struct group **result) {
return getgrnam_r(name, grp, buf, buflen, result);
}
*/
import "C"
@ -139,7 +144,7 @@ func lookupGroup(groupname string) (*Group, error) {
defer C.free(unsafe.Pointer(cname))
err := retryWithBuffer(buf, func() syscall.Errno {
return syscall.Errno(C.getgrnam_r(cname,
return syscall.Errno(C.mygetgrnam_r(cname,
&grp,
(*C.char)(buf.ptr),
C.size_t(buf.size),