Newsgroups: comp.sys.atari.st.tech
Path: utzoo!utdoe!david
From: david@doe.utoronto.ca (David Megginson)
Subject: Re: bug in GNU library
Message-ID: <1991Mar27.152726.8444@doe.utoronto.ca>
Summary: stat() function changes Fgetdta() address
Keywords: stat() bug
Reply-To: david@doe.utoronto.ca (David Megginson)
Organization: Dictionary of Old English Project, University of Toronto
Date: Wed, 27 Mar 1991 15:27:26 GMT


In <1991Mar27.030421.587@netcom.COM>, Roy Bixler writes:
> 
> I've found a bug (or at least an unintuitive feature :-) ) in the
> library supplied with GNU C 1.37.1 found on atari.archive.  When I
> make a call to stat(), after the call, the address returned by
> Fgetdta() is different than it was before the call.  Is this a bug?
> If so, why would it be desirable for stat() to have this side-effect?
> 
> -- 
> Roy Bixler
> rcb@netcom.com -or- (UUCP) uunet!apple!netcom!rcb

That's precisely why you have to call Fgetdta(). Usually, you would not
want to mix Unix-type calls (stat()) and TOS-type calls (Fsfirst()/Fsnext())
in the same program anyway, but if you have to, always check.

The reason it changes it is that stat() most likely uses Fsfirst()/Fsnext()
to check the file's status, and it has to set up its own DTA buffer
to do it.

In general, you might want to switch to Eric Smith's MiNT library. It
is an update and improvement on the standard GCC library, and is
also available on atari.archive.


-- 
////////////////////////////////////////////////////////////////////////
/  David Megginson                      david@doe.utoronto.ca          /
/  Centre for Medieval Studies          meggin@vm.epas.utoronto.ca     /
////////////////////////////////////////////////////////////////////////
