Merge pull request #28140 from tonistiigi/update-fifo
vendor: update fifo to 14056439
This commit is contained in:
commit
16ea0806f8
|
@ -97,7 +97,7 @@ github.com/docker/docker-credential-helpers f72c04f1d8e71959a6d103f808c50ccbad79
|
||||||
|
|
||||||
# containerd
|
# containerd
|
||||||
github.com/docker/containerd 52ef1ceb4b660c42cf4ea9013180a5663968d4c7
|
github.com/docker/containerd 52ef1ceb4b660c42cf4ea9013180a5663968d4c7
|
||||||
github.com/tonistiigi/fifo b4c3a126bac4051ae3fa83bfcb3c60ab7a9da0dd
|
github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4
|
||||||
|
|
||||||
# cluster
|
# cluster
|
||||||
github.com/docker/swarmkit 29950a4e9912178cadb72abc5a445e3a857cb2b0
|
github.com/docker/swarmkit 29950a4e9912178cadb72abc5a445e3a857cb2b0
|
||||||
|
|
|
@ -97,7 +97,7 @@ func OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.Re
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
err = ctx.Err()
|
err = ctx.Err()
|
||||||
default:
|
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 {
|
if file != nil {
|
||||||
file.Close()
|
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
|
// Close the fifo. Next reads/writes will error. This method can also be used
|
||||||
// before open(2) has returned and fifo was never opened.
|
// before open(2) has returned and fifo was never opened.
|
||||||
func (f *fifo) Close() error {
|
func (f *fifo) Close() (retErr error) {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-f.closed:
|
case <-f.closed:
|
||||||
f.handle.Close()
|
f.handle.Close()
|
||||||
return f.err
|
return
|
||||||
default:
|
default:
|
||||||
select {
|
select {
|
||||||
case <-f.opened:
|
case <-f.opened:
|
||||||
f.closedOnce.Do(func() {
|
f.closedOnce.Do(func() {
|
||||||
f.err = f.file.Close()
|
retErr = f.file.Close()
|
||||||
|
f.err = retErr
|
||||||
close(f.closed)
|
close(f.closed)
|
||||||
})
|
})
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -18,6 +18,7 @@ type handle struct {
|
||||||
dev uint64
|
dev uint64
|
||||||
ino uint64
|
ino uint64
|
||||||
closeOnce sync.Once
|
closeOnce sync.Once
|
||||||
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func getHandle(fn string) (*handle, error) {
|
func getHandle(fn string) (*handle, error) {
|
||||||
|
@ -33,9 +34,10 @@ func getHandle(fn string) (*handle, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
h := &handle{
|
h := &handle{
|
||||||
f: f,
|
f: f,
|
||||||
dev: stat.Dev,
|
name: fn,
|
||||||
ino: stat.Ino,
|
dev: stat.Dev,
|
||||||
|
ino: stat.Ino,
|
||||||
}
|
}
|
||||||
|
|
||||||
// check /proc just in case
|
// check /proc just in case
|
||||||
|
@ -51,6 +53,10 @@ func (h *handle) procPath() string {
|
||||||
return fmt.Sprintf("/proc/self/fd/%d", h.f.Fd())
|
return fmt.Sprintf("/proc/self/fd/%d", h.f.Fd())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *handle) Name() string {
|
||||||
|
return h.name
|
||||||
|
}
|
||||||
|
|
||||||
func (h *handle) Path() (string, error) {
|
func (h *handle) Path() (string, error) {
|
||||||
var stat syscall.Stat_t
|
var stat syscall.Stat_t
|
||||||
if err := syscall.Stat(h.procPath(), &stat); err != nil {
|
if err := syscall.Stat(h.procPath(), &stat); err != nil {
|
||||||
|
|
|
@ -35,11 +35,15 @@ func (h *handle) Path() (string, error) {
|
||||||
return "", errors.Wrapf(err, "path %v could not be statted", h.fn)
|
return "", errors.Wrapf(err, "path %v could not be statted", h.fn)
|
||||||
}
|
}
|
||||||
if uint64(stat.Dev) != h.dev || stat.Ino != h.ino {
|
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
|
return h.fn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *handle) Name() string {
|
||||||
|
return h.fn
|
||||||
|
}
|
||||||
|
|
||||||
func (h *handle) Close() error {
|
func (h *handle) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue