Skip to content

Commit 1485a34

Browse files
JohannesEbkecpuguy83
authored andcommitted
Also create epoll and pipe fds with close-on-exec (fsnotify#155) (fsnotify#219)
* Add the unix.O_CLOEXEC to the Pipe2 call * Add unix.EPOLL_CLOEXEC to the Epoll call
1 parent 11844c0 commit 1485a34

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

inotify_poller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ func newFdPoller(fd int) (*fdPoller, error) {
4040
poller.fd = fd
4141

4242
// Create epoll fd
43-
poller.epfd, errno = unix.EpollCreate1(0)
43+
poller.epfd, errno = unix.EpollCreate1(unix.EPOLL_CLOEXEC)
4444
if poller.epfd == -1 {
4545
return nil, errno
4646
}
4747
// Create pipe; pipe[0] is the read end, pipe[1] the write end.
48-
errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK)
48+
errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK|unix.O_CLOEXEC)
4949
if errno != nil {
5050
return nil, errno
5151
}

0 commit comments

Comments
 (0)