Re: Write to a closed stream bug.

Philip Blundell (Philip.Blundell@pobox.com)
Sat, 20 Dec 1997 21:07:00 +0000


>This does not fix the observed behavior unless a close(fd) results in
>any associated FILE object being set to NULL as well.

Would you like to explain _how_ one could arrange for close(fd) to locate and
update all the associated FILE* objects? Even if this could be done with
magic in close(), would you then get upset if programs that called the close()
syscall directly failed to work?

The stdio system is the way it is because of its buffering. If you mix calls
to stdio and calls to open(), read() and so on, you need to take the
appropriate care - if you don't, and you get burned, this is your fault.

By the way:

>The current 'C' standard (ANSI C3.159-1989, called POSIX) also provides:
> printf(3S) Standard I/O Functions printf(3S)

The text you quoted looks distinctly unlike a standards document, and POSIX is
not a synonym for ANSI C.

p.