Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Buffered stderr on Linux



>>>>> "Zoltan" == Zoltan Hidvegi <hzoli@xxxxxxxxxx> writes:

Zoltan> Bart Schaefer wrote:
>> 
>> Stdio will call free() on the buffer at fclose().  That means you should
>> always pass malloc'd buffers, and never call free() yourself on a buffer
>> that's been passed to any of the setbuf() variants!

Zoltan> Well I've just checked it on Solaris and Linux and it seems
Zoltan> that you are wrong.
 ...
Zoltan> It means that static buffer can be used with setvbuf.

I checked the source code to Linux libc 5.2.18 && libc 5.3.5 and
Zoltan is correct -- a buffer set by setvbuf is not freed upon fclose().

What does the standard say?  My copy of IEEE 1003.1 mentions setvbuf
but doesn't assign any specific details to it.

-- 
steve@xxxxxxxxxxxx baur
Unsolicited commercial e-mail will be proofread for $250/hour.
Andrea Seastrand: For your vote on the Telecom bill, I will vote for anyone
except you in November.




Messages sorted by: Reverse Date, Date, Thread, Author