This is the mail archive of the gcc-bugs@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]

Re: FreeBSD Fortran Failure


On 13 May 2001, Alexandre Oliva wrote:

> On May 13, 2001, Mark Mitchell <mark@codesourcery.com> wrote:
> 
> > I think that the reason for this might be that GETC is defined in
> > terms of stdio, and ftruncate operates on file descriptors.  So, if
> > the stdio buffer isn't flushed by the call to ftruncate, there could
> > still appear to be characters present.  Is that possible?
> 
> Good point.  We should probably fflush the FILE* before ftruncate, and
> try to do something about cleaning up its buffers afterwards (fseek to
> the current position, perhaps?)

POSIX.1 has two pages (subclause 8.2.3, pages 212-213 in the 1996 edition;
pages 485-486 in the current Austin Group draft; probably something in the
current online Single Unix Specification) describing how file descriptors
and stdio interact.  I suggest following them exactly.

-- 
Joseph S. Myers
jsm28@cam.ac.uk


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