error check unveil
This commit is contained in:
parent
bf09636bc1
commit
dea831d23f
10
unveil.go
10
unveil.go
|
@ -29,7 +29,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Unveil(path string, perms string) error {
|
func Unveil(path string, perms string) {
|
||||||
cpath := C.CString(path)
|
cpath := C.CString(path)
|
||||||
defer C.free(unsafe.Pointer(cpath))
|
defer C.free(unsafe.Pointer(cpath))
|
||||||
cperms := C.CString(perms)
|
cperms := C.CString(perms)
|
||||||
|
@ -37,20 +37,18 @@ func Unveil(path string, perms string) error {
|
||||||
|
|
||||||
rv, err := C.unveil(cpath, cperms)
|
rv, err := C.unveil(cpath, cperms)
|
||||||
if rv != 0 {
|
if rv != 0 {
|
||||||
return fmt.Errorf("unveil(%s, %s) failure (%d)", path, perms, err)
|
return elog.Fatalf("unveil(%s, %s) failure (%d)", path, perms, err)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Pledge(promises string) error {
|
func Pledge(promises string) {
|
||||||
cpromises := C.CString(promises)
|
cpromises := C.CString(promises)
|
||||||
defer C.free(unsafe.Pointer(cpromises))
|
defer C.free(unsafe.Pointer(cpromises))
|
||||||
|
|
||||||
rv, err := C.pledge(cpromises, nil)
|
rv, err := C.pledge(cpromises, nil)
|
||||||
if rv != 0 {
|
if rv != 0 {
|
||||||
return fmt.Errorf("pledge(%s) failure (%d)", promises, err)
|
elog.Fatalf("pledge(%s) failure (%d)", promises, err)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
Loading…
Reference in New Issue