mirror of
https://github.com/dennwc/btrfs
synced 2025-04-29 14:28:37 +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 {
|
if ro {
|
||||||
dir, err = os.OpenFile(path, os.O_RDONLY|syscall.O_NOATIME, 0644)
|
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 {
|
} else {
|
||||||
dir, err = os.Open(path)
|
dir, err = os.Open(path)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user