Skip to content

Commit a1f570b

Browse files
lethdennwc
authored andcommitted
Allow non-root users to query btrfs volumes
1 parent 3097362 commit a1f570b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

btrfs.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ func Open(path string, ro bool) (*FS, error) {
2929
)
3030
if ro {
3131
dir, err = os.OpenFile(path, os.O_RDONLY|syscall.O_NOATIME, 0644)
32+
if err != nil {
33+
// Try without O_NOATIME as it requires ownership of the file
34+
// or other priviliges
35+
dir, err = os.OpenFile(path, os.O_RDONLY, 0644)
36+
}
3237
} else {
3338
dir, err = os.Open(path)
3439
}

0 commit comments

Comments
 (0)