]> Cypherpunks repositories - gostls13.git/commitdiff
Getgroups max on Linux is bigger than I thought.
authorRuss Cox <rsc@golang.org>
Mon, 18 May 2009 21:56:25 +0000 (14:56 -0700)
committerRuss Cox <rsc@golang.org>
Mon, 18 May 2009 21:56:25 +0000 (14:56 -0700)
R=iant
DELTA=3  (2 added, 0 deleted, 1 changed)
OCL=28994
CL=29003

src/lib/os/user.go

index 1549abdcd5e3845cdc6e8830bf345b949cf45b0a..194aa50e445133c6b4e2e6f5b7c26bcb174f4b17 100644 (file)
@@ -44,7 +44,9 @@ func Getgroups() ([]int, os.Error) {
                return nil, ErrnoToError(err);
        }
 
-       if r1 < 0 || r1 > 1024 {        // the current max is 16; 1024 is a future-proof sanity check
+       // Sanity check group count.
+       // On Linux, max is 1<<16; on BSD, OS X, max is 16.
+       if r1 < 0 || r1 > 1<<20 {
                return nil, EINVAL;
        }
        a := make([]int, r1);