[PATCH] [BZ #12836] Make fmemopen(buf,size,"w+b") binary.

Ondřej Bílka neleai@seznam.cz
Thu May 9 16:17:00 GMT 2013


Posting Eric Blake patch from
http://sourceware.org/bugzilla/show_bug.cgi?id=12836

OK to commit?

	* libio/fmemopen.c (fmemopen) Make mode "w+b" binary.

---
 libio/fmemopen.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libio/fmemopen.c b/libio/fmemopen.c
index 02c764f..726ebd1 100644
--- a/libio/fmemopen.c
+++ b/libio/fmemopen.c
@@ -249,7 +249,7 @@ fmemopen (void *buf, size_t len, const char *mode)
   else
     c->pos = 0;
 
-  c->binmode = mode[0] != '\0' && mode[1] == 'b';
+  c->binmode = mode[0] && mode[1 + (mode[1] == '+')] == 'b';
 
   iof.read = fmemopen_read;
   iof.write = fmemopen_write;
-- 
1.7.4.4



More information about the Libc-alpha mailing list