This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Move is_valid_fd to filedescriptor.c file.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]