legit/unveil.go

27 lines
406 B
Go
Raw Normal View History

2022-12-18 05:34:11 +00:00
//go:build openbsd
// +build openbsd
package main
import (
2022-12-21 14:17:33 +00:00
"golang.org/x/sys/unix"
2022-12-18 05:34:11 +00:00
)
func Unveil(path string, perms string) error {
2022-12-21 14:17:33 +00:00
return unix.Unveil(path, perms)
}
func UnveilBlock() error {
return unix.UnveilBlock()
}
2022-12-18 05:34:11 +00:00
2022-12-21 14:17:33 +00:00
func UnveilPaths(paths []string, perms string) error {
for _, path := range paths {
err := Unveil(path, perms)
if err != nil {
return err
}
2022-12-18 05:34:11 +00:00
}
2022-12-21 14:17:33 +00:00
return UnveilBlock()
2022-12-18 05:34:11 +00:00
}