Mounted files showed up owned by 4294967295 (^uint32(0)) on OpenBSD. vfsflags_unix.go, which calls unix.Geteuid()/unix.Getegid() to get the real uid/gid, only builds for linux, darwin and freebsd; OpenBSD fell through to vfsflags_non_unix.go's zero-value stub instead. OpenBSD has no linux/darwin/freebsd-specific fields here, just the same POSIX Geteuid/Getegid/Umask calls golang.org/x/sys/unix already ships for openbsd on every arch, so this just adds openbsd to both build tags rather than needing a separate file. Cross-compiled for GOOS=openbsd (arm64, amd64) and go vet clean; ran the existing vfs test suite on darwin, no regressions. Not yet verified on a live OpenBSD mount, only that the right uid/gid syscalls now get called in this codepath. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
425 B
Go
25 lines
425 B
Go
//go:build linux || darwin || freebsd || openbsd
|
|
|
|
package vfscommon
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// get the current umask
|
|
func getUmask() int {
|
|
umask := unix.Umask(0) // read the umask
|
|
unix.Umask(umask) // set it back to what it was
|
|
return umask
|
|
}
|
|
|
|
// get the current uid
|
|
func getUID() uint32 {
|
|
return uint32(unix.Geteuid())
|
|
}
|
|
|
|
// get the current gid
|
|
func getGID() uint32 {
|
|
return uint32(unix.Getegid())
|
|
}
|