mirror of
https://github.com/dennwc/btrfs
synced 2025-01-18 05:20:46 +00:00
Allow non-root users to query btrfs volumes
This commit is contained in:
parent
3097362dc0
commit
a1f570bd01
5
btrfs.go
5
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user