From a1f570bd01a14302c88f46fc37fc3018a60f3370 Mon Sep 17 00:00:00 2001 From: Marcus Cobden Date: Sun, 12 Mar 2023 21:00:49 +0000 Subject: [PATCH] Allow non-root users to query btrfs volumes --- btrfs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/btrfs.go b/btrfs.go index 21fed51..79be04b 100644 --- a/btrfs.go +++ b/btrfs.go @@ -29,6 +29,11 @@ func Open(path string, ro bool) (*FS, error) { ) if ro { dir, err = os.OpenFile(path, os.O_RDONLY|syscall.O_NOATIME, 0644) + if err != nil { + // Try without O_NOATIME as it requires ownership of the file + // or other priviliges + dir, err = os.OpenFile(path, os.O_RDONLY, 0644) + } } else { dir, err = os.Open(path) }