diff --git a/vendor.conf b/vendor.conf index 97c43e6a26..eb25c86f2e 100644 --- a/vendor.conf +++ b/vendor.conf @@ -133,7 +133,7 @@ google.golang.org/genproto 3f1135a288c9a07e340ae8ba4cc6 # containerd github.com/containerd/containerd 19ee068f93c91f7b9b2a858457f1af2cabc7bc06 # master (v1.5.0-dev) -github.com/containerd/fifo 0724c46b320cf96bb172a0550c19a4b1fca4dacb +github.com/containerd/fifo 650e8a8a179d040123db61f016cb133143e7a581 # v1.0.0 github.com/containerd/continuity efbc4488d8fe1bdc16bde3b2d2990d9b3a899165 github.com/containerd/cgroups 0b889c03f102012f1d93a97ddd3ef71cd6f4f510 github.com/containerd/console 2f1e3d2b6afd18e8b2077816c711205a0b4d8769 # v1.0.2 diff --git a/vendor/github.com/containerd/fifo/errors.go b/vendor/github.com/containerd/fifo/errors.go index 9582096cb9..50f73b2dc0 100644 --- a/vendor/github.com/containerd/fifo/errors.go +++ b/vendor/github.com/containerd/fifo/errors.go @@ -16,9 +16,7 @@ package fifo -import ( - "errors" -) +import "errors" var ( ErrClosed = errors.New("fifo closed") diff --git a/vendor/github.com/containerd/fifo/fifo.go b/vendor/github.com/containerd/fifo/fifo.go index 96c214f270..45a9b38402 100644 --- a/vendor/github.com/containerd/fifo/fifo.go +++ b/vendor/github.com/containerd/fifo/fifo.go @@ -1,3 +1,5 @@ +// +build !windows + /* Copyright The containerd Authors. @@ -74,7 +76,7 @@ func OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.Re func openFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (*fifo, error) { if _, err := os.Stat(fn); err != nil { if os.IsNotExist(err) && flag&syscall.O_CREAT != 0 { - if err := mkfifo(fn, uint32(perm&os.ModePerm)); err != nil && !os.IsExist(err) { + if err := syscall.Mkfifo(fn, uint32(perm&os.ModePerm)); err != nil && !os.IsExist(err) { return nil, errors.Wrapf(err, "error creating fifo %v", fn) } } else { diff --git a/vendor/github.com/containerd/fifo/go.mod b/vendor/github.com/containerd/fifo/go.mod index 484ed125f4..0c1c48fab7 100644 --- a/vendor/github.com/containerd/fifo/go.mod +++ b/vendor/github.com/containerd/fifo/go.mod @@ -3,7 +3,7 @@ module github.com/containerd/fifo go 1.13 require ( - github.com/pkg/errors v0.8.1 - github.com/stretchr/testify v1.4.0 - golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 + github.com/pkg/errors v0.9.1 + github.com/stretchr/testify v1.6.1 + golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c ) diff --git a/vendor/github.com/containerd/fifo/handle_nolinux.go b/vendor/github.com/containerd/fifo/handle_nolinux.go index 4f2a282b2b..81ca308fe5 100644 --- a/vendor/github.com/containerd/fifo/handle_nolinux.go +++ b/vendor/github.com/containerd/fifo/handle_nolinux.go @@ -1,4 +1,4 @@ -// +build !linux +// +build !linux,!windows /* Copyright The containerd Authors. @@ -38,8 +38,8 @@ func getHandle(fn string) (*handle, error) { h := &handle{ fn: fn, - dev: uint64(stat.Dev), - ino: uint64(stat.Ino), + dev: uint64(stat.Dev), //nolint: unconvert + ino: uint64(stat.Ino), //nolint: unconvert } return h, nil @@ -50,7 +50,7 @@ func (h *handle) Path() (string, error) { if err := syscall.Stat(h.fn, &stat); err != nil { return "", errors.Wrapf(err, "path %v could not be statted", h.fn) } - if uint64(stat.Dev) != h.dev || uint64(stat.Ino) != h.ino { + if uint64(stat.Dev) != h.dev || uint64(stat.Ino) != h.ino { //nolint: unconvert return "", errors.Errorf("failed to verify handle %v/%v %v/%v for %v", stat.Dev, h.dev, stat.Ino, h.ino, h.fn) } return h.fn, nil diff --git a/vendor/github.com/containerd/fifo/mkfifo_solaris.go b/vendor/github.com/containerd/fifo/mkfifo_solaris.go deleted file mode 100644 index 1ecd722ae2..0000000000 --- a/vendor/github.com/containerd/fifo/mkfifo_solaris.go +++ /dev/null @@ -1,27 +0,0 @@ -// +build solaris - -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package fifo - -import ( - "golang.org/x/sys/unix" -) - -func mkfifo(path string, mode uint32) (err error) { - return unix.Mkfifo(path, mode) -} diff --git a/vendor/github.com/containerd/fifo/raw.go b/vendor/github.com/containerd/fifo/raw.go index 3b78a49c78..cead94ca27 100644 --- a/vendor/github.com/containerd/fifo/raw.go +++ b/vendor/github.com/containerd/fifo/raw.go @@ -1,4 +1,4 @@ -// +build go1.12 +// +build !windows /* Copyright The containerd Authors. diff --git a/vendor/github.com/containerd/fifo/readme.md b/vendor/github.com/containerd/fifo/readme.md index 30e233cc69..ad4727dfe5 100644 --- a/vendor/github.com/containerd/fifo/readme.md +++ b/vendor/github.com/containerd/fifo/readme.md @@ -1,7 +1,9 @@ ### fifo -[![Build Status](https://travis-ci.org/containerd/fifo.svg?branch=master)](https://travis-ci.org/containerd/fifo) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/fifo)](https://pkg.go.dev/github.com/containerd/fifo) +[![Build Status](https://github.com/containerd/fifo/workflows/CI/badge.svg)](https://github.com/containerd/fifo/actions?query=workflow%3ACI) [![codecov](https://codecov.io/gh/containerd/fifo/branch/master/graph/badge.svg)](https://codecov.io/gh/containerd/fifo) +[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/fifo)](https://goreportcard.com/report/github.com/containerd/fifo) Go package for handling fifos in a sane way. diff --git a/vendor/github.com/containerd/fifo/mkfifo_nosolaris.go b/vendor/github.com/containerd/fifo/utils.go similarity index 62% rename from vendor/github.com/containerd/fifo/mkfifo_nosolaris.go rename to vendor/github.com/containerd/fifo/utils.go index 2799a06d10..bbdf790154 100644 --- a/vendor/github.com/containerd/fifo/mkfifo_nosolaris.go +++ b/vendor/github.com/containerd/fifo/utils.go @@ -1,5 +1,3 @@ -// +build !solaris - /* Copyright The containerd Authors. @@ -18,8 +16,20 @@ package fifo -import "syscall" +import "os" -func mkfifo(path string, mode uint32) (err error) { - return syscall.Mkfifo(path, mode) +// IsFifo checks if a file is a (named pipe) fifo +// if the file does not exist then it returns false +func IsFifo(path string) (bool, error) { + stat, err := os.Stat(path) + if err != nil { + if os.IsNotExist(err) { + return false, nil + } + return false, err + } + if stat.Mode()&os.ModeNamedPipe == os.ModeNamedPipe { + return true, nil + } + return false, nil }