This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: FreeBSD Fortran Failure
- To: Alexandre Oliva <aoliva at redhat dot com>
- Subject: Re: FreeBSD Fortran Failure
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Sun, 13 May 2001 22:13:15 +0100 (BST)
- cc: Mark Mitchell <mark at codesourcery dot com>, <toon at moene dot indiv dot nluug dot nl>, <gcc-bugs at gcc dot gnu dot org>
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