This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]