This is the mail archive of the
gcc-patches@gcc.gnu.org
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: Martin Liška <mliska at suse dot cz>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 9 Aug 2019 11:05:42 -0700
- Subject: Re: [PATCH] Move is_valid_fd to filedescriptor.c file.
- References: <dc25d696-aa99-ee09-d6bb-be0c74e489fe@suse.cz>
On Fri, Aug 9, 2019 at 12:15 AM Martin Liška <mliska@suse.cz> wrote:
>
> As Jakub correctly noted, I used a piggy backing to put the new function
> to a file that is supposed to contain different functions. So that
> I'm suggesting a new file. Moreover, I'm also adding dup2 fallback.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
> libiberty/ChangeLog:
>
> 2019-08-08 Martin Liska <mliska@suse.cz>
>
> * 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.
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?
Ian