Sounds reasonable, thanks a lot for the help Ben.
On Mar 8, 2014 4:57 PM, "Ben Noordhuis" <notifications@github.com> wrote:

> In src/unix/stream.c:
>
> > @@ -93,6 +93,52 @@ static int uv__open_cloexec(const char* path, int flags) {
> >  }
> >
> >
> > +int uv__dup_cloexec(int oldfd, int newfd) {
> > +  int r;
> > +
> > +#if defined(__linux__)
> > +  static int no_dup3;
> > +  if (!no_dup3) {
> > +    do
> > +      r = uv__dup3(oldfd, newfd, UV__O_CLOEXEC);
> > +    while (r == -1 && (errno == EINTR || errno == EBUSY));
> > +    if (r == -1 && errno == ENOSYS)
> > +      no_dup3 = 1;
> > +    else if (r == -1)
> > +      return -errno;
> > +    return 0;
>
> In the inconceivable case that uv__cloexec() fails, the return value of
> uv__cloexec() (and it should close the file descriptor). Else it should
> return the new file descriptor.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/joyent/libuv/pull/1184/files#r10409677>
> .
>