From 162a0bf730ce0b3023f83f96e7b27202bd299824 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 29 Sep 2021 09:26:34 -0400 Subject: [PATCH] Create readonly locks if the lockfile does not exists Users are setting up readonly shares and sometimes they forget, or do not even know that they need to create the lockfile. Even in the quay.io/podman/stable images Dockerfile, I have to manually create these files. Fixes: https://github.com/containers/storage/issues/1029 Signed-off-by: Daniel J Walsh --- pkg/lockfile/lockfile_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/lockfile/lockfile_unix.go b/pkg/lockfile/lockfile_unix.go index b224e7b5cf..fc080acbed 100644 --- a/pkg/lockfile/lockfile_unix.go +++ b/pkg/lockfile/lockfile_unix.go @@ -36,7 +36,7 @@ type lockfile struct { // necessary. func openLock(path string, ro bool) (fd int, err error) { if ro { - fd, err = unix.Open(path, os.O_RDONLY|unix.O_CLOEXEC, 0) + fd, err = unix.Open(path, os.O_RDONLY|unix.O_CLOEXEC|os.O_CREATE, 0) } else { fd, err = unix.Open(path, os.O_RDWR|unix.O_CLOEXEC|os.O_CREATE,