summaryrefslogtreecommitdiffstats
path: root/unveil.go
blob: 3b4803ea4582a75778a09e54d117d9dac58f7909 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//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()
}