This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] PR 20179
- From: Paul Brook <paul at codesourcery dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Janne Blomqvist <jblomqvi at cc dot hut dot fi>,FX Coudert <fxcoudert at gmail dot com>,gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 May 2005 14:35:50 +0100
- Subject: Re: [gfortran] PR 20179
- References: <4292C729.1030500@gmail.com> <20050524070156.GA20354@vipunen.hut.fi>
On Tuesday 24 May 2005 08:01, Janne Blomqvist wrote:
> On Tue, May 24, 2005 at 08:18:17AM +0200, FX Coudert wrote:
> > Attached patch fixes PR 20179, about mixing C and Fortran I/O. In
> > short: we don't want to close() stdout and stderr file descriptors
> > when the library exits.
>
> Uh, wouldn't the correct thing be a flush followed by close()?
> fclose() does flush before closing, but AFAIK there is no such
> guarantee for close().
According to my linux manpages close() provides exactly the same guarantees as
fclose(). They guarantee that all userspace buffers have been flushed, but do
not guarantee that the kernel has actually written the data to disk. This is
only important if you're paranoid about unexpected power outages or kernel
panics.
The difference is that C FILE* io has an extra level of buffering ontop of the
unix IO later. fclose() guarantees that this has been flushed. For close() it
doesn't exist so there's nothing to do.
Paul