From ceffcc527ee2b8f9f4265fbcd3ff6b670413bbf6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 20 Oct 2020 22:46:48 +0200 Subject: [PATCH] vendor: github.com/gofrs/flock v0.7.3 full diff: https://github.com/gofrs/flock/compare/v0.7.1...v0.7.3 Relevant changes: - fix: close/Unlock won't close the file descriptor if not locked - fix license text, update year Note that there's also a v0.8.0 release; that release only adds aix support, which is currently of no interest to us, so skipping that version for now. Signed-off-by: Sebastiaan van Stijn --- vendor.conf | 2 +- vendor/github.com/gofrs/flock/LICENSE | 8 ++++---- vendor/github.com/gofrs/flock/README.md | 2 +- vendor/github.com/gofrs/flock/flock.go | 8 ++++++++ vendor/github.com/gofrs/flock/flock_unix.go | 2 ++ vendor/github.com/gofrs/flock/flock_windows.go | 2 ++ 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/vendor.conf b/vendor.conf index 7485e67a81..28b9f32feb 100755 --- a/vendor.conf +++ b/vendor.conf @@ -23,7 +23,7 @@ github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca2 github.com/docker/swarmkit d6592ddefd8a5319aadff74c558b816b1a0b2590 github.com/evanphx/json-patch 72bf35d0ff611848c1dc9df0f976c81192392fa5 # v4.1.0 github.com/fvbommel/sortorder a1ddee917217bbd0691affdca9c88d24d3f5c27d # v1.0.1 -github.com/gofrs/flock 392e7fae8f1b0bdbd67dad7237d23f618feb6dbb # v0.7.1 +github.com/gofrs/flock 6caa7350c26b838538005fae7dbee4e69d9398db # v0.7.3 github.com/gogo/googleapis 01e0f9cca9b92166042241267ee2a5cdf5cff46c # v1.3.2 github.com/gogo/protobuf 5628607bb4c51c3157aacc3a50f0ab707582b805 # v1.3.1 github.com/golang/glog 23def4e6c14b4da8ac2ed8007337bc5eb5007998 diff --git a/vendor/github.com/gofrs/flock/LICENSE b/vendor/github.com/gofrs/flock/LICENSE index aff7d358e2..8b8ff36fe4 100644 --- a/vendor/github.com/gofrs/flock/LICENSE +++ b/vendor/github.com/gofrs/flock/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015, Tim Heckman +Copyright (c) 2015-2020, Tim Heckman All rights reserved. Redistribution and use in source and binary forms, with or without @@ -11,9 +11,9 @@ modification, are permitted provided that the following conditions are met: this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of linode-netint nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. +* Neither the name of gofrs nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/vendor/github.com/gofrs/flock/README.md b/vendor/github.com/gofrs/flock/README.md index 7375e72eeb..71ce63692e 100644 --- a/vendor/github.com/gofrs/flock/README.md +++ b/vendor/github.com/gofrs/flock/README.md @@ -1,6 +1,6 @@ # flock [![TravisCI Build Status](https://img.shields.io/travis/gofrs/flock/master.svg?style=flat)](https://travis-ci.org/gofrs/flock) -[![GoDoc](https://img.shields.io/badge/godoc-go--flock-blue.svg?style=flat)](https://godoc.org/github.com/gofrs/flock) +[![GoDoc](https://img.shields.io/badge/godoc-flock-blue.svg?style=flat)](https://godoc.org/github.com/gofrs/flock) [![License](https://img.shields.io/badge/license-BSD_3--Clause-brightgreen.svg?style=flat)](https://github.com/gofrs/flock/blob/master/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/gofrs/flock)](https://goreportcard.com/report/github.com/gofrs/flock) diff --git a/vendor/github.com/gofrs/flock/flock.go b/vendor/github.com/gofrs/flock/flock.go index 8f109b8a96..2fd1603376 100644 --- a/vendor/github.com/gofrs/flock/flock.go +++ b/vendor/github.com/gofrs/flock/flock.go @@ -125,3 +125,11 @@ func (f *Flock) setFh() error { f.fh = fh return nil } + +// ensure the file handle is closed if no lock is held +func (f *Flock) ensureFhState() { + if !f.l && !f.r && f.fh != nil { + f.fh.Close() + f.fh = nil + } +} diff --git a/vendor/github.com/gofrs/flock/flock_unix.go b/vendor/github.com/gofrs/flock/flock_unix.go index 45f71a707c..366a60ca6d 100644 --- a/vendor/github.com/gofrs/flock/flock_unix.go +++ b/vendor/github.com/gofrs/flock/flock_unix.go @@ -51,6 +51,7 @@ func (f *Flock) lock(locked *bool, flag int) error { if err := f.setFh(); err != nil { return err } + defer f.ensureFhState() } if err := syscall.Flock(int(f.fh.Fd()), flag); err != nil { @@ -142,6 +143,7 @@ func (f *Flock) try(locked *bool, flag int) (bool, error) { if err := f.setFh(); err != nil { return false, err } + defer f.ensureFhState() } var retried bool diff --git a/vendor/github.com/gofrs/flock/flock_windows.go b/vendor/github.com/gofrs/flock/flock_windows.go index 9f4a5f10d2..ddb534ccef 100644 --- a/vendor/github.com/gofrs/flock/flock_windows.go +++ b/vendor/github.com/gofrs/flock/flock_windows.go @@ -46,6 +46,7 @@ func (f *Flock) lock(locked *bool, flag uint32) error { if err := f.setFh(); err != nil { return err } + defer f.ensureFhState() } if _, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag, 0, 1, 0, &syscall.Overlapped{}); errNo > 0 { @@ -122,6 +123,7 @@ func (f *Flock) try(locked *bool, flag uint32) (bool, error) { if err := f.setFh(); err != nil { return false, err } + defer f.ensureFhState() } _, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag|winLockfileFailImmediately, 0, 1, 0, &syscall.Overlapped{})