Update linux-core.c

This patch allows dup2 cloned fd to work with the event handler as intended.
That was my understanding too.
On Aug 5, 2014 8:25 PM, "Ben Noordhuis" <notifications@github.com> wrote:

> In src/unix/linux-core.c:
>
> > @@ -177,6 +177,22 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
> >       * events, skip the syscall and squelch the events after epoll_wait().
> >       */
> >      if (uv__epoll_ctl(loop->backend_fd, op, w->fd, &e)) {
> > +      /*
> > +       * Allow fd generated by dup2 to work.
> > +       * The original fd was monitored by the backend_fd ... dup2 close the original fd
> > +       * and cloned the new fd inplaced of the original. The following codes will allow
> > +       * cloned fd continue to work as intend.
> > +       */
>
> The comment wasn't very elucidating to me, maybe you can rephrase it? I
> think the situation you're trying to address here is:
>
>    1. This file descriptor has been watched before.
>    2. Something that wasn't libuv closed it. The descriptor was removed
>    from the epoll set.
>    3. Libuv still thinks it exists and tries to EPOLL_CTL_MOD its entry
>    in the epoll set.
>    4. That fails with ENOENT because of 2 so try EPOLL_CTL_ADD.
>
> That's right, isn't it?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/joyent/libuv/pull/1397/files#r15831578>.
>