From: Patrick Date: Tue, 11 Oct 2016 02:24:00 +0000 (-0700) Subject: Create inotify fd with close-on-exec (#178) X-Git-Tag: v1.7.2~183 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=11054bcfedcc693de29270308bda9b4230791742;p=fsnotify.git Create inotify fd with close-on-exec (#178) * Create inotify fd with close-on-exec * switch to unix.IN_CLOEXEC --- diff --git a/inotify.go b/inotify.go index 9700df5..f3b74c5 100644 --- a/inotify.go +++ b/inotify.go @@ -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 }