Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!mhuxm!mhuxf!mhuxi!mhuhk!mhuxt!houxm!whuxl!whuxlm!akgua!gatech!seismo!ll-xn!topaz!bentley!kwh From: kwh@bentley.UUCP Newsgroups: net.bugs.usg Subject: Re: Bug with multiple stdio streams on one descriptor, FIX Message-ID: <674@bentley.UUCP> Date: Fri, 28-Mar-86 14:56:11 EST Article-I.D.: bentley.674 Posted: Fri Mar 28 14:56:11 1986 Date-Received: Tue, 1-Apr-86 06:43:22 EST References: <562@stride.stride.UUCP> Organization: AT&T Bell Laboratories, Liberty Corner Lines: 20 In article <562@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