Bug with multiple stdio streams on one descriptor, FIX

kwh at bentley.UUCP kwh at bentley.UUCP
Sat Mar 29 05:56:11 AEST 1986


In article <562 at stride.stride.UUCP> stride!bruce (Bruce Robertson) writes:
>The problem is, the table is referenced like this:
>	_bufendtab[(p)->_file]
>where `p' is your FILE pointer.  This is wrong.  What you really
>want to do is reference the table like this:
>	_bufendtab[(p) - &_iob[0]]
>which associates slots in the table of pointers with slots in
>the table of _iob structures.

This assumes that all objects of type FILE are in the _iob[] array.
This is not necessarily the case; e.g. there is an auto variable of type
FILE (not FILE*) in sprintf(); there may be others.

Are you sure that having two streams on one descriptor is legal?  Is there
any documentation that explicitly permits or forbids it?

Now, the *real* question.  Why is _bufendtab[] in a separate array, rather
than being another field in the FILE structure where it seems to belong?

Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint



More information about the Net.bugs.usg mailing list