Fix O_NOATIME permission error

This commit is contained in:
Florian Weingarten 2015-04-26 00:54:33 +00:00
parent 87a1946417
commit 90284b9498
1 changed files with 5 additions and 1 deletions

View File

@ -12,7 +12,11 @@ import (
)
func (node *Node) OpenForReading() (*os.File, error) {
return os.OpenFile(node.path, os.O_RDONLY|syscall.O_NOATIME, 0)
file, err := os.OpenFile(node.path, os.O_RDONLY|syscall.O_NOATIME, 0)
if os.IsPermission(err) {
return os.OpenFile(node.path, os.O_RDONLY, 0)
}
return file, err
}
func (node *Node) fillExtra(path string, fi os.FileInfo) error {