summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inotify/syscall.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/inotify/syscall.go b/inotify/syscall.go
index 245bc41..1b5c426 100644
--- a/inotify/syscall.go
+++ b/inotify/syscall.go
@@ -8,6 +8,13 @@ import (
type Cint C.int
+func pathError(op string, path string, err error) error {
+ if err == nil {
+ return nil
+ }
+ return &os.PathError{Op: op, Path: path, Err: err}
+}
+
/* Create and initialize inotify instance. */
func inotify_init() (Cint, error) {
fd, errno := syscall.InotifyInit()
@@ -24,7 +31,7 @@ func inotify_init1(flags Cint) (Cint, error) {
events specified by MASK. */
func inotify_add_watch(fd Cint, name string, mask uint32) (Cint, error) {
wd, errno := syscall.InotifyAddWatch(int(fd), name, mask)
- return Cint(wd), os.NewSyscallError("inotify_add_watch", errno)
+ return Cint(wd), pathError("inotify_add_watch", name, errno)
}
/* Remove the watch specified by WD from the inotify instance FD. */