mirror of
https://github.com/golang/sys.git
synced 2026-01-29 07:02:06 +03:00
review
This commit is contained in:
@@ -20,8 +20,7 @@ import (
|
||||
//
|
||||
// For more information see pledge(2).
|
||||
func Pledge(promises, execpromises string) error {
|
||||
err := pledgeAvailable()
|
||||
if err != nil {
|
||||
if err := pledgeAvailable(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -50,8 +49,7 @@ func Pledge(promises, execpromises string) error {
|
||||
//
|
||||
// For more information see pledge(2).
|
||||
func PledgePromises(promises string) error {
|
||||
err := pledgeAvailable()
|
||||
if err != nil {
|
||||
if err := pledgeAvailable(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -78,8 +76,7 @@ func PledgePromises(promises string) error {
|
||||
//
|
||||
// For more information see pledge(2).
|
||||
func PledgeExecpromises(execpromises string) error {
|
||||
err := pledgeAvailable()
|
||||
if err != nil {
|
||||
if err := pledgeAvailable(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -133,8 +130,7 @@ func pledgeAvailable() error {
|
||||
|
||||
// Require OpenBSD 6.4 as a minimum.
|
||||
if maj < 6 || (maj == 6 && min <= 3) {
|
||||
return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj,
|
||||
min)
|
||||
return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj, min)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -15,8 +15,7 @@ import (
|
||||
// Note that the special case of blocking further
|
||||
// unveil calls is handled by UnveilBlock.
|
||||
func Unveil(path string, flags string) error {
|
||||
err := supportsUnveil()
|
||||
if err != nil {
|
||||
if err := supportsUnveil(); err != nil {
|
||||
return err
|
||||
}
|
||||
pathPtr, err := syscall.BytePtrFromString(path)
|
||||
@@ -37,8 +36,7 @@ func Unveil(path string, flags string) error {
|
||||
// UnveilBlock blocks future unveil calls.
|
||||
// For more information see unveil(2).
|
||||
func UnveilBlock() error {
|
||||
err := supportsUnveil()
|
||||
if err != nil {
|
||||
if err := supportsUnveil(); err != nil {
|
||||
return err
|
||||
}
|
||||
// Both pointers must be nil.
|
||||
@@ -60,8 +58,7 @@ func supportsUnveil() error {
|
||||
|
||||
// unveil is not available before 6.4
|
||||
if maj < 6 || (maj == 6 && min <= 3) {
|
||||
return fmt.Errorf("cannot call Unveil on OpenBSD %d.%d", maj,
|
||||
min)
|
||||
return fmt.Errorf("cannot call Unveil on OpenBSD %d.%d", maj, min)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user