Commit fc1bea32 authored by Joel Sing's avatar Joel Sing Committed by Ian Lance Taylor

os/user: fix user lookups on dragonfly

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
parent fba015ec
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment