diff --git a/vendor.conf b/vendor.conf index 0fac061170..c3b71d8f9b 100644 --- a/vendor.conf +++ b/vendor.conf @@ -97,7 +97,7 @@ github.com/docker/docker-credential-helpers f72c04f1d8e71959a6d103f808c50ccbad79 # containerd github.com/docker/containerd 52ef1ceb4b660c42cf4ea9013180a5663968d4c7 -github.com/tonistiigi/fifo b4c3a126bac4051ae3fa83bfcb3c60ab7a9da0dd +github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4 # cluster github.com/docker/swarmkit 29950a4e9912178cadb72abc5a445e3a857cb2b0 diff --git a/vendor/github.com/tonistiigi/fifo/fifo.go b/vendor/github.com/tonistiigi/fifo/fifo.go index 9fa2d1a3ae..9e8e2ca374 100644 --- a/vendor/github.com/tonistiigi/fifo/fifo.go +++ b/vendor/github.com/tonistiigi/fifo/fifo.go @@ -97,7 +97,7 @@ func OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.Re case <-ctx.Done(): err = ctx.Err() default: - err = errors.Errorf("fifo %v was closed before opening", fn) + err = errors.Errorf("fifo %v was closed before opening", h.Name()) } if file != nil { file.Close() @@ -163,17 +163,18 @@ func (f *fifo) Write(b []byte) (int, error) { // Close the fifo. Next reads/writes will error. This method can also be used // before open(2) has returned and fifo was never opened. -func (f *fifo) Close() error { +func (f *fifo) Close() (retErr error) { for { select { case <-f.closed: f.handle.Close() - return f.err + return default: select { case <-f.opened: f.closedOnce.Do(func() { - f.err = f.file.Close() + retErr = f.file.Close() + f.err = retErr close(f.closed) }) default: diff --git a/vendor/github.com/tonistiigi/fifo/handle_linux.go b/vendor/github.com/tonistiigi/fifo/handle_linux.go index 7a3a57c655..7bda64ca67 100644 --- a/vendor/github.com/tonistiigi/fifo/handle_linux.go +++ b/vendor/github.com/tonistiigi/fifo/handle_linux.go @@ -18,6 +18,7 @@ type handle struct { dev uint64 ino uint64 closeOnce sync.Once + name string } func getHandle(fn string) (*handle, error) { @@ -33,9 +34,10 @@ func getHandle(fn string) (*handle, error) { } h := &handle{ - f: f, - dev: stat.Dev, - ino: stat.Ino, + f: f, + name: fn, + dev: stat.Dev, + ino: stat.Ino, } // check /proc just in case @@ -51,6 +53,10 @@ func (h *handle) procPath() string { return fmt.Sprintf("/proc/self/fd/%d", h.f.Fd()) } +func (h *handle) Name() string { + return h.name +} + func (h *handle) Path() (string, error) { var stat syscall.Stat_t if err := syscall.Stat(h.procPath(), &stat); err != nil { diff --git a/vendor/github.com/tonistiigi/fifo/handle_nolinux.go b/vendor/github.com/tonistiigi/fifo/handle_nolinux.go index 8c20e0746a..d9648d8bfa 100644 --- a/vendor/github.com/tonistiigi/fifo/handle_nolinux.go +++ b/vendor/github.com/tonistiigi/fifo/handle_nolinux.go @@ -35,11 +35,15 @@ func (h *handle) Path() (string, error) { return "", errors.Wrapf(err, "path %v could not be statted", h.fn) } if uint64(stat.Dev) != h.dev || stat.Ino != h.ino { - return "", errors.Errorf("failed to verify handle %v/%v %v/%v", stat.Dev, h.dev, stat.Ino, h.ino) + 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 } +func (h *handle) Name() string { + return h.fn +} + func (h *handle) Close() error { return nil }