Thread View: net.bugs
2 messages
2 total messages
Started by crl
Fri, 09 Sep 1983 16:18
bug in stdio (setbuf) ?
Author: crl
Date: Fri, 09 Sep 1983 16:18
Date: Fri, 09 Sep 1983 16:18
17 lines
1326 bytes
1326 bytes
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
Re: bug in stdio (setbuf) ?
Author: Guy Harris
Date: Mon, 12 Sep 1983 04:43
Date: Mon, 12 Sep 1983 04:43
7 lines
814 bytes
814 bytes
This bug also causes problems if the buffer is static (it gets reused
improperly). See my article 1127@rlgvax.UUCP. Article 30@ism780.UUCP
stated that the simple fix won't fix it, and that it has been fixed in
System V.
Guy Harris
{seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads