Skip to content

Commit

Permalink
Allow non-root users to query btrfs volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
leth authored and dennwc committed Mar 12, 2023
1 parent 3097362 commit a1f570b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions btrfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit a1f570b

Please sign in to comment.