From ba8c92c1660bf86dfeedfc41ac39683c7e0d7607 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 22 Jan 2014 10:35:41 -0800 Subject: syscall: use unsafe.Pointer in BSD kevent Doesn't really matter for the most part, since the runtime-integrated network poller uses its own kevent implementation, but for people using the syscall directly, we should use an unsafe.Pointer for the precise GC to retain the pointer arguments. Also push down unsafe.Pointer a bit further in exec_linux.go, not that there are any GC preemption points in the middle and sys is still live anyway. R=golang-codereviews, dvyukov CC=golang-codereviews, iant https://golang.org/cl/55520043 --- src/pkg/syscall/exec_linux.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/pkg/syscall/exec_linux.go') diff --git a/src/pkg/syscall/exec_linux.go b/src/pkg/syscall/exec_linux.go index a1656e8dce..f27950f730 100644 --- a/src/pkg/syscall/exec_linux.go +++ b/src/pkg/syscall/exec_linux.go @@ -131,11 +131,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // User and groups if cred := sys.Credential; cred != nil { ngroups := uintptr(len(cred.Groups)) - groups := uintptr(0) + var groups unsafe.Pointer if ngroups > 0 { - groups = uintptr(unsafe.Pointer(&cred.Groups[0])) + groups = unsafe.Pointer(&cred.Groups[0]) } - _, _, err1 = RawSyscall(SYS_SETGROUPS, ngroups, groups, 0) + _, _, err1 = RawSyscall(SYS_SETGROUPS, ngroups, uintptr(groups), 0) if err1 != 0 { goto childerror } -- cgit v1.3-5-g9baa