Skip to content

Commit

Permalink
Also create epoll and pipe fds with close-on-exec (fsnotify#155)
Browse files Browse the repository at this point in the history
* Add the unix.O_CLOEXEC to the Pipe2 call
* Add unix.EPOLL_CLOEXEC to the Epoll call
  • Loading branch information
JohannesEbke committed Oct 14, 2018
1 parent ccc981b commit df57317
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inotify_poller.go
Expand Up @@ -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
}
Expand Down

0 comments on commit df57317

Please sign in to comment.