mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
- fix: missing read-write flag in reopenFDOnError fixes a regression that could result in a `ERROR: bad file descriptor`.b659e1e00aintroduced a regression where `f.flag` would not be in read-write mode [1] but read-only [2] which breaks people using NFS protocol. [1]:b659e1e00a (diff-87c2c4fe0fb43f4b38b4bee45c1b54cfb694c61e311f93b369caa44f6c1323ffR192)[2]:b659e1e00a (diff-22145325dded38eb5288ed3321a113d8260ccc70747ee04d4551bfd2fba975fdR69)full diff: https://github.com/gofrs/flock/compare/v0.12.0...v0.12.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
flock
flock implements a thread-safe file lock.
It also includes a non-blocking TryLock() function to allow locking without blocking execution.
Installation
go get -u github.com/gofrs/flock
Usage
import "github.com/gofrs/flock"
fileLock := flock.New("/var/lock/go-lock.lock")
locked, err := fileLock.TryLock()
if err != nil {
// handle locking error
}
if locked {
// do work
fileLock.Unlock()
}
For more detailed usage information take a look at the package API docs on GoDoc.
License
flock is released under the BSD 3-Clause License. See the LICENSE file for more details.
Project History
This project was originally github.com/theckman/go-flock, it was transferred to Gofrs by the original author Tim Heckman .