summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-09-05 00:34:21 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-09-05 00:34:21 -0600
commit0d064cbe0675f9029b6ac27d12c6f462b18ffe82 (patch)
treeb6ead5e5bc63398fd751a8eba84464d2cf7c40f9
parentdc7fdfa4e869c8e54652746bf2e64b2397f1dcdc (diff)
clean up logging
-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. */