This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Move is_valid_fd to filedescriptor.c file.
- From: Ian Lance Taylor <iant at golang dot org>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Martin Liška <mliska at suse dot cz>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 9 Aug 2019 11:16:29 -0700
- Subject: Re: [PATCH] Move is_valid_fd to filedescriptor.c file.
- References: <firstname.lastname@example.org> <CAOyqgcUGZVFUc9Y1zD1=8e0=7heshw=5ptgJR-oF1+VvA6tdrw@mail.gmail.com> <20190809181316.GE2726@tucnak>
On Fri, Aug 9, 2019 at 11:13 AM Jakub Jelinek <email@example.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:
> I thought they had a reason but maybe they don't.
> It was added in
Well, if it's need for Mingw it's fine with me, fixed as you suggest above.