Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site pur-phy.UUCP Path: utzoo!linus!decvax!genrad!mit-eddie!mit-vax!eagle!hou5h!hou5g!hou5f!hou5e!hou5d!hogpc!houxm!ihnp4!ixn5c!inuxc!pur-ee!CSvax:Pucc-H:pur-phy!crl From: crl@CSvax:Pucc-H:pur-phy.UUCP Newsgroups: net.bugs Subject: bug in stdio (setbuf) ? Message-ID: <909@pur-phy.UUCP> Date: Fri, 9-Sep-83 12:18:41 EDT Article-I.D.: pur-phy.909 Posted: Fri Sep 9 12:18:41 1983 Date-Received: Sat, 10-Sep-83 20:26:54 EDT Organization: Purdue Univ. Physics Dept., W. Lafayette, IN Lines: 17 I think I have discovered a bug in the way stdio handles its buffers when you've used setbuf(). We run 2.8 BSD, but I bet it's present elsewhere. It seems that iop->_base is not set to NULL by fclose if you've used a setbuf() to assign your own buffer. The specific code is: if (iop->_flag & _IOMYBUF) free(iop->_base); if (iop->_flag & (_IOMYBUF|_IONBF)) iop->_base = NULL; in fclose(). Thus, if _base was pointing to your stack, you'll in for problems the next time you fopen() since this does not zero it either. I can't think of a good reason why _base should not be zeroed on an fclose(). Comments? Charles LaBrec UUCP: pur-ee!Physics:crl, purdue!Physics:crl INTERNET: crl @ pur-phy.UUCP