fstat returns wrong filesize

Stefan Bellon sbellon at sbellon.de
Sat Aug 17 05:05:22 PDT 2002

Nick Burrett wrote:
> Alex Waugh wrote:

> > Calling fstat often results in a wrong value being returned for the
> > filesize. This is because OS_File which is used to get the file
> > info returns the size allocated to the file, which (if the file is
> > open at the time) can be different to the extent of the file. The
> > following patch fixes this.

> Thanks.  Committed.

file_desc->handle in line 69 of source/unix/fstat.c should be cast to
int (like it is in other places) as otherwise Norcroft fails with:

cc -depend !Depend -throwback -fcah -JUnixHdr: -wda -wp  -APCS
3/26bit/fpe2 -D__UNIXLIB_INTERNALS -c -o unix.o.fstat
Norcroft RISC OS ARM C vsn 5.44 [12 Apr 2002]
"^.source.unix.c.fstat", line 69: Error: <function argument 2>:
implicit cast of pointer to 'int'

 Stefan Bellon * <mailto:sbellon at sbellon.de> * <http://www.sbellon.de/>
 PGP 2 and OpenPGP keys available from my home page

 The internet has had no effect on my life wwwhatsoever.com

More information about the gcc mailing list