mirror of
https://github.com/containers/podman.git
synced 2025-12-11 09:18:34 +08:00
vendor buildah, image, storage, cni
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
7
vendor/github.com/containers/storage/lockfile.go
generated
vendored
7
vendor/github.com/containers/storage/lockfile.go
generated
vendored
@@ -35,7 +35,7 @@ type Locker interface {
|
||||
// IsReadWrite() checks if the lock file is read-write
|
||||
IsReadWrite() bool
|
||||
|
||||
// Locked() checks if lock is locked
|
||||
// Locked() checks if lock is locked for writing by a thread in this process
|
||||
Locked() bool
|
||||
}
|
||||
|
||||
@@ -66,7 +66,10 @@ func getLockfile(path string, ro bool) (Locker, error) {
|
||||
if lockfiles == nil {
|
||||
lockfiles = make(map[string]Locker)
|
||||
}
|
||||
cleanPath := filepath.Clean(path)
|
||||
cleanPath, err := filepath.Abs(path)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error ensuring that path %q is an absolute path", path)
|
||||
}
|
||||
if locker, ok := lockfiles[cleanPath]; ok {
|
||||
if ro && locker.IsReadWrite() {
|
||||
return nil, errors.Errorf("lock %q is not a read-only lock", cleanPath)
|
||||
|
||||
Reference in New Issue
Block a user