added pledge and unveil support
This commit is contained in:
parent
23731a3702
commit
089d8d16c8
8 changed files with 116 additions and 15 deletions
32
unveil_openbsd.go
Normal file
32
unveil_openbsd.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2018 Marius Schellenberger
|
||||
|
||||
// +build openbsd
|
||||
|
||||
package godrop
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// Unveil is a wrapper for x/sys/unix Unveil.
|
||||
//
|
||||
// See https://go.googlesource.com/sys/+/master/unix/openbsd_unveil.go for usage.
|
||||
func Unveil(path, flags string) (err error) {
|
||||
err = unix.Unveil(path, flags)
|
||||
if err != nil {
|
||||
err = errors.New("unveil: ", err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UnveilBlock is a wrapper for x/sys/unix UnveilBlock.
|
||||
//
|
||||
// See https://go.googlesource.com/sys/+/master/unix/openbsd_unveil.go for usage.
|
||||
func UnveilBlock() (err error) {
|
||||
err = unix.UnveilBlock()
|
||||
if err != nil {
|
||||
err = errors.New("unveil: ", err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue