On Fri, Aug 9, 2019 at 11:13 AM Jakub Jelinek <ja...@redhat.com> wrote:
>
> On Fri, Aug 09, 2019 at 11:05:42AM -0700, Ian Lance Taylor wrote:
> > >         * Makefile.in: Add filedescriptor.c.
> > >         * filedescriptor.c: New file.
> > >         * lrealpath.c (is_valid_fd): Remove.
> >
> >
> > I don't understand the dup2 fallback.  It looks backward: if dup2(fd,
> > fd) will return -1 if fd does not exist.
>
> Sure, it should be >= 0 instead of < 0.
>
> > I also don't think it's needed.  fcntl(fd, F_GETFD) should work on all
> > Unix systems.  It should certainly work on all Unix systems that have
> > dup2.  What systems are you concerned about?
>
> That was just my suggestion based on what gnulib does:
> http://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/fcntl.c
> I thought they had a reason but maybe they don't.
> It was added in
> http://git.savannah.gnu.org/cgit/gnulib.git/commit/lib/fcntl.c?id=021c8619190757f535c72ad5cdb1d624e19620d6

Well, if it's need for Mingw it's fine with me, fixed as you suggest above.

Ian

Reply via email to