[patch] Fix initilization problem in open_memstream
Corinna Vinschen
vinschen@redhat.com
Thu Feb 20 13:32:00 GMT 2014
Hi list,
I just applied the below patch. I was testing an application which
neglected to print a string which had been created via open_memstream
functionality. When debugging I found that the buffer was never flushed
in _sflush_r, because a member of the internal memstream structure
hadn't been initialized in internal_open_memstream_r. The below
patch fixes the problem.
Corinna
* libc/stdio/open_memstream.c (internal_open_memstream_r): Initialize
c->pos to 0.
Index: libc/stdio/open_memstream.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/open_memstream.c,v
retrieving revision 1.8
diff -u -p -r1.8 open_memstream.c
--- libc/stdio/open_memstream.c 23 Oct 2013 10:04:43 -0000 1.8
+++ libc/stdio/open_memstream.c 20 Feb 2014 13:25:25 -0000
@@ -355,6 +355,7 @@ _DEFUN(internal_open_memstream_r, (ptr,
c->storage = c;
c->pbuf = buf;
c->psize = size;
+ c->pos = 0;
c->eof = 0;
c->saved.w = L'\0';
c->wide = (int8_t) wide;
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20140220/4aa06c5b/attachment.sig>
More information about the Newlib
mailing list