From 0d064cbe0675f9029b6ac27d12c6f462b18ffe82 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 5 Sep 2015 00:34:21 -0600 Subject: clean up logging --- inotify/syscall.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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. */ -- cgit v1.2.3-54-g00ecf