[PATCH] second try: Add call to_IO_setbuffer() in fmemopen() after calling _IO_fopencookie()

Ryan Arnold rsa@us.ibm.com
Thu Apr 20 19:22:00 GMT 2006


Greetings,

Sorry about the malformed ChangeLog.  I'll try again.

I've been working bugzilla
http://sourceware.org/bugzilla/show_bug.cgi?id=1995

In summary, the default stream buffering (block) will allow a caller to
write more bytes to a stream than the buffer backing the stream (created
by fmemopen()) can hold.

An fflush() or fclose() does not overflow the backing buffer but the
extra data on the stream is lost.

As discussed in the bugzilla entry, this problem can be avoided by
changing the buffering on the stream or by setting the stream buffer
size to that of the backing buffer.

Alternatively, I've attached a patch that sets the buffer size on the
stream within the fmemopen() function if that is a more desirable
solution.  Personally I'm ambivalent but I'm not sure I like the idea of
changing implicit block buffering but in this case it may be justified.

Thanks,
-- 
Ryan S. Arnold <rsa@us.ibm.com>
IBM Linux Technology Center
Linux on Power Toolchain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fmemopen.patch
Type: text/x-patch
Size: 717 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20060420/f4d385f3/attachment.bin>


More information about the Libc-alpha mailing list