legit/unveil.go

31 lines
481 B
Go
Raw Normal View History

2022-12-18 05:34:11 +00:00
//go:build openbsd
// +build openbsd
2022-12-19 06:38:31 +00:00
// Doesn't do anything yet.
2022-12-18 05:34:11 +00:00
package main
/*
#include <stdlib.h>
#include <unistd.h>
*/
import "C"
import (
"fmt"
"unsafe"
)
func Unveil(path string, perms string) error {
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
cperms := C.CString(perms)
defer C.free(unsafe.Pointer(cperms))
rv, err := C.unveil(cpath, cperms)
if rv != 0 {
return fmt.Errorf("unveil(%s, %s) failure (%d)", path, perms, err)
}
return nil
}