From 90284b949898cec16d5b66cad582df1b86f063de Mon Sep 17 00:00:00 2001 From: Florian Weingarten Date: Sun, 26 Apr 2015 00:54:33 +0000 Subject: [PATCH] Fix O_NOATIME permission error --- node_linux.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node_linux.go b/node_linux.go index ab73460e3..aef5c1e3a 100644 --- a/node_linux.go +++ b/node_linux.go @@ -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 {