kqueue requires opening a file descriptor for every file; so we read the
directory and do that. If this failed the error was quite unclear; for
example:
"/tmp/fsnotify_permission_denied/": permission denied
This puts the filepath in there:
"/tmp/fsnotify_permission_denied/": "/tmp/fsnotify_permission_denied/test2.log": permission denied
Fixes #270
}
}
- watchfd, err = unix.Open(name, openMode, 0700)
+ watchfd, err = unix.Open(name, openMode, 0)
if watchfd == -1 {
return "", err
}
filePath := filepath.Join(dirPath, fileInfo.Name())
filePath, err = w.internalWatch(filePath, fileInfo)
if err != nil {
- return err
+ return fmt.Errorf("%q: %w", filepath.Join(dirPath, fileInfo.Name()), err)
}
w.mu.Lock()