]> Cypherpunks repositories - gostls13.git/commitdiff
os/user: fix user lookups on dragonfly
authorJoel Sing <jsing@google.com>
Mon, 7 Oct 2013 16:21:33 +0000 (09:21 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 7 Oct 2013 16:21:33 +0000 (09:21 -0700)
Like FreeBSD, DragonFly does not provide a sysconf value for
_SC_GETPW_R_SIZE_MAX.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14469043

src/pkg/os/user/lookup_unix.go

index e709f7e521bb084ec0c026d319c4fe714bf10a2b..5459268fa0133b58290bc3166a0d99daddd793e6 100644 (file)
@@ -50,10 +50,10 @@ func lookupUnix(uid int, username string, lookupByName bool) (*User, error) {
        var result *C.struct_passwd
 
        var bufSize C.long
-       if runtime.GOOS == "freebsd" {
-               // FreeBSD doesn't have _SC_GETPW_R_SIZE_MAX
-               // and just returns -1.  So just use the same
-               // size that Linux returns
+       if runtime.GOOS == "dragonfly" || runtime.GOOS == "freebsd" {
+               // DragonFly and FreeBSD do not have _SC_GETPW_R_SIZE_MAX
+               // and just return -1.  So just use the same
+               // size that Linux returns.
                bufSize = 1024
        } else {
                bufSize = C.sysconf(C._SC_GETPW_R_SIZE_MAX)