Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Oct 24, 2023
1 parent ab98739 commit d03d157
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
12 changes: 4 additions & 8 deletions unix/pledge_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions unix/unveil_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit d03d157

Please sign in to comment.