bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: portability of fopen and 'e' (O_CLOEXEC) flag


From: Bruno Haible
Subject: Re: portability of fopen and 'e' (O_CLOEXEC) flag
Date: Sun, 24 May 2020 21:22:28 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; )

Tim Rühsen wrote on 2020-05-12:
> > How about using open() with O_CLOEXEC, and then fdopen()?
> 
> Thanks. Sure, this is possible. Doing so at dozens of places (or more)
> asks for an implementation in gnulib :)

Additionally, gnulib is the right place to do this because - as Eric said -
the 'e' flag is already scheduled for being added to the next POSIX version:
https://www.austingroupbugs.net/view.php?id=411

My evaluation of current platform support was incorrect: Current versions of
FreeBSD, NetBSD, OpenBSD, Solaris, Cygwin, and even Minix already support it.


2020-05-24  Bruno Haible  <address@hidden>

        fopen-gnu: Add tests.
        * tests/test-fopen-gnu.c: New file.
        * modules/fopen-gnu-tests: New file.

        fopen-gnu: New module.
        Suggested by Tim Rühsen <address@hidden> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00119.html>.
        * lib/fopen.c (rpl_fopen): When the fopen-gnu module is enabled and the
        mode contains an 'x' or 'e' flag, use open() followed by fdopen().
        * m4/fopen.m4 (gl_FUNC_FOPEN_GNU): New macro.
        * modules/fopen-gnu: New file.
        * doc/posix-functions/fopen.texi: Document the 'fopen-gnu' module.

Attachment: 0001-fopen-gnu-New-module.patch
Description: Text Data

Attachment: 0002-fopen-gnu-Add-tests.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]