Skip to content

Commit d03d157

Browse files
committed
review
1 parent ab98739 commit d03d157

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

Diff for: unix/pledge_openbsd.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import (
2020
//
2121
// For more information see pledge(2).
2222
func Pledge(promises, execpromises string) error {
23-
err := pledgeAvailable()
24-
if err != nil {
23+
if err := pledgeAvailable(); err != nil {
2524
return err
2625
}
2726

@@ -50,8 +49,7 @@ func Pledge(promises, execpromises string) error {
5049
//
5150
// For more information see pledge(2).
5251
func PledgePromises(promises string) error {
53-
err := pledgeAvailable()
54-
if err != nil {
52+
if err := pledgeAvailable(); err != nil {
5553
return err
5654
}
5755

@@ -78,8 +76,7 @@ func PledgePromises(promises string) error {
7876
//
7977
// For more information see pledge(2).
8078
func PledgeExecpromises(execpromises string) error {
81-
err := pledgeAvailable()
82-
if err != nil {
79+
if err := pledgeAvailable(); err != nil {
8380
return err
8481
}
8582

@@ -133,8 +130,7 @@ func pledgeAvailable() error {
133130

134131
// Require OpenBSD 6.4 as a minimum.
135132
if maj < 6 || (maj == 6 && min <= 3) {
136-
return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj,
137-
min)
133+
return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj, min)
138134
}
139135

140136
return nil

Diff for: unix/unveil_openbsd.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import (
1515
// Note that the special case of blocking further
1616
// unveil calls is handled by UnveilBlock.
1717
func Unveil(path string, flags string) error {
18-
err := supportsUnveil()
19-
if err != nil {
18+
if err := supportsUnveil(); err != nil {
2019
return err
2120
}
2221
pathPtr, err := syscall.BytePtrFromString(path)
@@ -37,8 +36,7 @@ func Unveil(path string, flags string) error {
3736
// UnveilBlock blocks future unveil calls.
3837
// For more information see unveil(2).
3938
func UnveilBlock() error {
40-
err := supportsUnveil()
41-
if err != nil {
39+
if err := supportsUnveil(); err != nil {
4240
return err
4341
}
4442
// Both pointers must be nil.
@@ -60,8 +58,7 @@ func supportsUnveil() error {
6058

6159
// unveil is not available before 6.4
6260
if maj < 6 || (maj == 6 && min <= 3) {
63-
return fmt.Errorf("cannot call Unveil on OpenBSD %d.%d", maj,
64-
min)
61+
return fmt.Errorf("cannot call Unveil on OpenBSD %d.%d", maj, min)
6562
}
6663

6764
return nil

0 commit comments

Comments
 (0)