diff --git a/vendor.conf b/vendor.conf index 1ab9f8432f..c8fc505e9b 100644 --- a/vendor.conf +++ b/vendor.conf @@ -118,7 +118,7 @@ google.golang.org/genproto 694d95ba50e67b2e363f3483057d # containerd github.com/containerd/containerd 36cf5b690dcc00ff0f34ff7799209050c3d0c59a # v1.3.0 -github.com/containerd/fifo a9fb20d87448d386e6d50b1f2e1fa70dcf0de43c +github.com/containerd/fifo bda0ff6ed73c67bfb5e62bc9c697f146b7fd7f13 github.com/containerd/continuity f2a389ac0a02ce21c09edd7344677a601970f41c github.com/containerd/cgroups c4b9ac5c7601384c965b9646fc515884e091ebb9 github.com/containerd/console 0650fd9eeb50bab4fc99dceb9f2e14cf58f36e7f diff --git a/vendor/github.com/containerd/fifo/errors.go b/vendor/github.com/containerd/fifo/errors.go new file mode 100644 index 0000000000..d2ff3e8b60 --- /dev/null +++ b/vendor/github.com/containerd/fifo/errors.go @@ -0,0 +1,30 @@ +/* + 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 ( + "errors" +) + +var ( + ErrClosed = errors.New("fifo closed") + ErrCtrlClosed = errors.New("control of closed fifo") + ErrRdFrmWRONLY = errors.New("reading from write-only fifo") + ErrReadClosed = errors.New("reading from a closed fifo") + ErrWrToRDONLY = errors.New("writing to read-only fifo") + ErrWriteClosed = errors.New("writing to a closed fifo") +) diff --git a/vendor/github.com/containerd/fifo/fifo.go b/vendor/github.com/containerd/fifo/fifo.go index e79813da7d..7a2d18c744 100644 --- a/vendor/github.com/containerd/fifo/fifo.go +++ b/vendor/github.com/containerd/fifo/fifo.go @@ -147,7 +147,7 @@ func OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.Re // Read from a fifo to a byte array. func (f *fifo) Read(b []byte) (int, error) { if f.flag&syscall.O_WRONLY > 0 { - return 0, errors.New("reading from write-only fifo") + return 0, ErrRdFrmWRONLY } select { case <-f.opened: @@ -158,14 +158,14 @@ func (f *fifo) Read(b []byte) (int, error) { case <-f.opened: return f.file.Read(b) case <-f.closed: - return 0, errors.New("reading from a closed fifo") + return 0, ErrReadClosed } } // Write from byte array to a fifo. func (f *fifo) Write(b []byte) (int, error) { if f.flag&(syscall.O_WRONLY|syscall.O_RDWR) == 0 { - return 0, errors.New("writing to read-only fifo") + return 0, ErrWrToRDONLY } select { case <-f.opened: @@ -176,7 +176,7 @@ func (f *fifo) Write(b []byte) (int, error) { case <-f.opened: return f.file.Write(b) case <-f.closed: - return 0, errors.New("writing to a closed fifo") + return 0, ErrWriteClosed } } diff --git a/vendor/github.com/containerd/fifo/raw.go b/vendor/github.com/containerd/fifo/raw.go index acc303e437..27b8976cde 100644 --- a/vendor/github.com/containerd/fifo/raw.go +++ b/vendor/github.com/containerd/fifo/raw.go @@ -20,8 +20,6 @@ package fifo import ( "syscall" - - "github.com/pkg/errors" ) // SyscallConn provides raw access to the fifo's underlying filedescrptor. @@ -30,13 +28,13 @@ func (f *fifo) SyscallConn() (syscall.RawConn, error) { // deterministic check for closed select { case <-f.closed: - return nil, errors.New("fifo closed") + return nil, ErrClosed default: } select { case <-f.closed: - return nil, errors.New("fifo closed") + return nil, ErrClosed case <-f.opened: return f.file.SyscallConn() default: @@ -68,7 +66,7 @@ type rawConn struct { func (r *rawConn) Control(f func(fd uintptr)) error { select { case <-r.f.closed: - return errors.New("control of closed fifo") + return ErrCtrlClosed case <-r.ready: } @@ -81,12 +79,12 @@ func (r *rawConn) Control(f func(fd uintptr)) error { func (r *rawConn) Read(f func(fd uintptr) (done bool)) error { if r.f.flag&syscall.O_WRONLY > 0 { - return errors.New("reading from write-only fifo") + return ErrRdFrmWRONLY } select { case <-r.f.closed: - return errors.New("reading of a closed fifo") + return ErrReadClosed case <-r.ready: } @@ -99,12 +97,12 @@ func (r *rawConn) Read(f func(fd uintptr) (done bool)) error { func (r *rawConn) Write(f func(fd uintptr) (done bool)) error { if r.f.flag&(syscall.O_WRONLY|syscall.O_RDWR) == 0 { - return errors.New("writing to read-only fifo") + return ErrWrToRDONLY } select { case <-r.f.closed: - return errors.New("writing to a closed fifo") + return ErrWriteClosed case <-r.ready: }