]> go.fuhry.dev Git - fsnotify.git/commitdiff
Create inotify fd with close-on-exec (#178)
authorPatrick <patrick@dropbox.com>
Tue, 11 Oct 2016 02:24:00 +0000 (19:24 -0700)
committerNathan Youngman <git@nathany.com>
Tue, 11 Oct 2016 02:24:00 +0000 (20:24 -0600)
* Create inotify fd with close-on-exec

* switch to unix.IN_CLOEXEC

inotify.go

index 9700df55e9ace34ba12b3ab941b31b8c530a7c44..f3b74c51f0ffaf53f5fe145c7003f086b5d1a0d3 100644 (file)
@@ -36,7 +36,7 @@ type Watcher struct {
 // NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
 func NewWatcher() (*Watcher, error) {
        // Create inotify fd
-       fd, errno := unix.InotifyInit()
+       fd, errno := unix.InotifyInit1(unix.IN_CLOEXEC)
        if fd == -1 {
                return nil, errno
        }