[comp.sys.atari.st] Double open file warning

apratt@atari.UUCP (Allan Pratt) (01/10/90)

Talking with Dale Schumacher led to the following concise warning:

	If the same file is open more than once, it's trouble.

That is, if you Fopen a file, then Fopen it again without calling
Fclose on the first handle first, you are courting disaster.  When
either handle is Fclosed, using the other one might or might not lead
to any sensible results.

This ESPECIALLY applies to having the same file open by two different
processes: if you Fopen a file, then Pexec a child, and that child
Fopens the same file, you're in deep doo-doo.  When the child Fcloses
the file, or Pterms (which closes all its files), the handle in the
parent might or might not refer to anything sensible.

Fdup and Fforce suffer from the same problems.  It's all in the data
structures which turn handles into files and eventually into blocks on
disk.  They're done wrong.  This is true for all existing TOSes:
1.0, 1.2, 1.4, and 1.6.

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt