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, libgfortran] Set close-on-exec flag when opening files


PING

On Wed, Oct 30, 2013 at 1:39 AM, Janne Blomqvist
<blomqvist.janne@gmail.com> wrote:
> Hello,
>
> the attached patch sets the close-on-exec flag when opening files, as
> is usually considered good practice these days. See e.g.
> http://www.python.org/dev/peps/pep-0446/ and links therein for more
> information.
>
> The preconnected units INPUT_UNIT, OUTPUT_UNIT, ERROR_UNIT are not
> affected, only new units created with the OPEN statement. In the
> (very!?) unlikely event that someone really needs Fortran units to be
> inherited to child processes, the close-on-exec flag can be cleared
> with fcntl() before calling one of the exec() family functions.
>
> Regtested on x86_64-unknown-linux-gnu, Ok for trunk?
>
> 2013-10-30  Janne Blomqvist  <jb@gcc.gnu.org>
>
>     * configure.ac: Check presence of mkostemp.
>     * io/unix.c (set_close_on_exec): New function.
>     (tempfile_open): Use mkostemp and O_CLOEXEC if available, fallback
>     to calling set_close_on_exec.
>     (regular_file): Add O_CLOEXEC to flags if defined.
>     (open_external): Call set_close_on_exec if O_CLOEXEC is not
>     defined.
>     * config.h.in: Regenerated.
>     * configure: Regenerated.
>
>
> --
> Janne Blomqvist



-- 
Janne Blomqvist


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