Hello,
I am sorry, I don't know this is a bug or something.
Which operating system (GOOS) and version are you using?
ProductName: Mac OS X
ProductVersion: 10.14
BuildVersion: 18A391
Steps to reproduce
cd /tmp && mkdir fsnotify_permission_denied
cd fsnotify_permission_denied
touch test1.log test2.log
chmod 0300 test2.log
go run main.go
// main.go
package main
import (
"log"
"github.com/fsnotify/fsnotify"
)
func ExampleNewWatcher() {
watcher, err := fsnotify.NewWatcher()
if err != nil {
log.Fatal(err)
}
defer watcher.Close()
err = watcher.Add("/tmp/fsnotify_permission_denied")
if err != nil {
log.Fatal("fatal: ", err)
}
}
func main() {
ExampleNewWatcher()
}
As result
$ go run main.go
2018/10/02 16:21:08 fatal: permission denied
exit status 1
Why is it try open file with 0700 permissions?
|
watchfd, err = unix.Open(name, openMode, 0700) |
Thank you.