From: Johannes Ebke Date: Tue, 12 Mar 2019 18:14:46 +0000 (+0100) Subject: Also create epoll and pipe fds with close-on-exec (#155) (#219) X-Git-Tag: v1.7.2~160 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=1485a34d5d5723fea214f5710708e19a831720e4;p=fsnotify.git Also create epoll and pipe fds with close-on-exec (#155) (#219) * Add the unix.O_CLOEXEC to the Pipe2 call * Add unix.EPOLL_CLOEXEC to the Epoll call --- diff --git a/inotify_poller.go b/inotify_poller.go index cc7db4b..b33f2b4 100644 --- a/inotify_poller.go +++ b/inotify_poller.go @@ -40,12 +40,12 @@ func newFdPoller(fd int) (*fdPoller, error) { poller.fd = fd // Create epoll fd - poller.epfd, errno = unix.EpollCreate1(0) + poller.epfd, errno = unix.EpollCreate1(unix.EPOLL_CLOEXEC) if poller.epfd == -1 { return nil, errno } // Create pipe; pipe[0] is the read end, pipe[1] the write end. - errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK) + errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK|unix.O_CLOEXEC) if errno != nil { return nil, errno }