About that "w+" bug in 4.3...
Donn Seeley
donn at utah-cs.UUCP
Fri Oct 17 10:57:15 AEST 1986
Here's some fixes I made to the 4.3 beta fputs(). The first change
solves a problem with _IORW stdio FILEs; the second fixes a problem
with unbuffered FILEs. The source is in /usr/src/lib/libc/vax/stdio/fputs.c.
------------------------------------------------------------------------
*** /tmp/,RCSt1013008 Mon Oct 13 22:59:50 1986
--- /tmp/,RCSt2013008 Mon Oct 13 22:59:51 1986
***************
*** 64,71 ****
jbr 2f
1:
! tstl _BASE(IOP) /* Has a buffer been allocated? */
! jneq 2f
pushl IOP /* Get _flsbuf() to do the work */
pushl $0
calls $2,__flsbuf
--- 64,71 ----
jbr 2f
1:
! tstl _CNT(IOP) /* Has a buffer been allocated? */
! jgtr 2f
pushl IOP /* Get _flsbuf() to do the work */
pushl $0
calls $2,__flsbuf
***************
*** 90,95 ****
--- 90,97 ----
movl r3,_PTR(IOP) /* Fix up IOP */
subl2 COUNT,_CNT(IOP)
bitw $LBF,_FLAG(IOP) /* If line buffered... */
+ jneq 1f
+ tstw UNBUF /* or unbuffered... */
jneq 1f
tstl _CNT(IOP) /* or a full buffer... */
jgtr 2f
------------------------------------------------------------------------
Equivalent fixes were made to puts.c, too. This fix should be in the
4.3 BSD release -- if you're not running it, you probably should be.
Donn Seeley University of Utah CS Dept donn at utah-cs.arpa
40 46' 6"N 111 50' 34"W (801) 581-5668 decvax!utah-cs!donn
PS -- There's at least one minor bug in the distributed fputs(), too;
so it goes.
More information about the Comp.unix
mailing list