diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-05 00:34:21 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-05 00:34:21 -0600 |
commit | 6b94a9b6588112328fa2738b1c149b48908f5029 (patch) | |
tree | 4e7e11ad85997855af38b219a1b8193e1e4dab88 /src/inotify/syscall.go | |
parent | 066fe52728294bf764ccb89750eecae634a4c1a6 (diff) |
clean up logging
Diffstat (limited to 'src/inotify/syscall.go')
-rw-r--r-- | src/inotify/syscall.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/inotify/syscall.go b/src/inotify/syscall.go index 245bc41..1b5c426 100644 --- a/src/inotify/syscall.go +++ b/src/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. */ |