legit/unveil.go
2022-12-22 11:35:32 +05:30

28 lines
488 B
Go

//go:build openbsd
// +build openbsd
package main
import (
"golang.org/x/sys/unix"
"log"
)
func Unveil(path string, perms string) error {
log.Printf("unveil: \"%s\", %s", path, perms)
return unix.Unveil(path, perms)
}
func UnveilBlock() error {
log.Printf("unveil: block")
return unix.UnveilBlock()
}
func UnveilPaths(paths []string, perms string) error {
for _, path := range paths {
if err := Unveil(path, perms); err != nil {
return err
}
}
return UnveilBlock()
}