diff options
Diffstat (limited to 'vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent')
-rw-r--r-- | vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/parent.go | 18 | ||||
-rw-r--r-- | vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/udp/udp.go | 5 |
2 files changed, 10 insertions, 13 deletions
diff --git a/vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/parent.go b/vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/parent.go index c6eecc826..1c53e26a6 100644 --- a/vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/parent.go +++ b/vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/parent.go @@ -2,9 +2,9 @@ package parent import ( "context" + "errors" "fmt" "io" - "io/ioutil" "net" "os" "path/filepath" @@ -14,8 +14,6 @@ import ( "syscall" "time" - "github.com/pkg/errors" - "github.com/rootless-containers/rootlesskit/pkg/api" "github.com/rootless-containers/rootlesskit/pkg/port" "github.com/rootless-containers/rootlesskit/pkg/port/builtin/msg" @@ -32,10 +30,10 @@ func NewDriver(logWriter io.Writer, stateDir string) (port.ParentDriver, error) childReadyPipePath := filepath.Join(stateDir, ".bp-ready.pipe") // remove the path just in case the previous rootlesskit instance crashed if err := os.RemoveAll(childReadyPipePath); err != nil { - return nil, errors.Wrapf(err, "cannot remove %s", childReadyPipePath) + return nil, fmt.Errorf("cannot remove %s: %w", childReadyPipePath, err) } if err := syscall.Mkfifo(childReadyPipePath, 0600); err != nil { - return nil, errors.Wrapf(err, "cannot mkfifo %s", childReadyPipePath) + return nil, fmt.Errorf("cannot mkfifo %s: %w", childReadyPipePath, err) } d := driver{ logWriter: logWriter, @@ -79,7 +77,7 @@ func (d *driver) RunParentDriver(initComplete chan struct{}, quit <-chan struct{ if err != nil { return err } - if _, err = ioutil.ReadAll(childReadyPipeR); err != nil { + if _, err = io.ReadAll(childReadyPipeR); err != nil { return err } childReadyPipeR.Close() @@ -110,7 +108,7 @@ func annotateEPERM(origErr error, spec port.Spec) error { // Read "net.ipv4.ip_unprivileged_port_start" value (typically 1024) // TODO: what for IPv6? // NOTE: sync.Once should not be used here - b, e := ioutil.ReadFile("/proc/sys/net/ipv4/ip_unprivileged_port_start") + b, e := os.ReadFile("/proc/sys/net/ipv4/ip_unprivileged_port_start") if e != nil { return origErr } @@ -129,7 +127,7 @@ func annotateEPERM(origErr error, spec port.Spec) error { text += ", or set CAP_NET_BIND_SERVICE on rootlesskit binary" } text += fmt.Sprintf(", or choose a larger port number (>= %d)", start) - return errors.Wrap(origErr, text) + return fmt.Errorf(text+": %w", origErr) } func (d *driver) AddPort(ctx context.Context, spec port.Spec) (*port.Status, error) { @@ -152,7 +150,7 @@ func (d *driver) AddPort(ctx context.Context, spec port.Spec) (*port.Status, err } return errors.New("routineStoppedCh was closed without sending data?") case <-ctx.Done(): - return errors.Wrap(err, "timed out while waiting for routineStoppedCh after closing routineStopCh") + return fmt.Errorf("timed out while waiting for routineStoppedCh after closing routineStopCh: %w", err) } } switch spec.Proto { @@ -198,7 +196,7 @@ func (d *driver) RemovePort(ctx context.Context, id int) error { defer d.mu.Unlock() stop, ok := d.stoppers[id] if !ok { - return errors.Errorf("unknown id: %d", id) + return fmt.Errorf("unknown id: %d", id) } if _, ok := ctx.Deadline(); !ok { var cancel context.CancelFunc diff --git a/vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/udp/udp.go b/vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/udp/udp.go index 67062117a..47f3a6461 100644 --- a/vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/udp/udp.go +++ b/vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/udp/udp.go @@ -1,13 +1,12 @@ package udp import ( + "fmt" "io" "net" "os" "strconv" - "github.com/pkg/errors" - "github.com/rootless-containers/rootlesskit/pkg/port" "github.com/rootless-containers/rootlesskit/pkg/port/builtin/msg" "github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/udp/udpproxy" @@ -39,7 +38,7 @@ func Run(socketPath string, spec port.Spec, stopCh <-chan struct{}, stoppedCh ch } uc, ok := fc.(*net.UDPConn) if !ok { - return nil, errors.Errorf("file conn doesn't implement *net.UDPConn: %+v", fc) + return nil, fmt.Errorf("file conn doesn't implement *net.UDPConn: %+v", fc) } return uc, nil }, |