Orphaned Response

kah kah at hpfclq.UUCP
Thu Nov 15 14:07:00 AEST 1984


/***** hpfclq:net.bugs.usg / clyde! /  6:59 pm  Oct 15, 1984*/
In the USG (AT&T) Unix System V Release 2 Programmer Reference Manual
lists the calling sequence for setvbuf(3S) [under setbuf(3S)] as:

int setvbuf (stream, buf, type, size)

the actual code, however, is looking for:

int setvbuf (stream, type, buf, size)

This problem will be reported to the Unix Hotline shortly.  ...
/* ---------- */

The mixup in parameter order is the least of the problems with the V.2
setvbuf source.  The source contains numerous bugs including:
	(1) They never set iop->_base = buf;
	    I.e., the parameter "buf" is never even used!
	(2) If the user does not provide a buffer, the code uses malloc
	    to generate one.  But it doesn't set the _IOMYBUF bit so
	    that the buffer space can be freed later when the file is
	    closed.
	(3) The tests to determine when a malloc should be done are 
	    wrong .
	  ...

In short the "setvbuf.c" source file is a "basket case"; if you need 
the functionality of setvbuf, I suggest you write your own.  That's
what we did.

Kathy Harris
Hewlett Packard, Fort Collins Systems Division
hpfcla!kah



More information about the Net.bugs.usg mailing list