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: [gfortran] PR 20179


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


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