aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--io.c8
2 files changed, 16 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f7d49bf2e..484fb7eccd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue May 31 14:17:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_io_s_pipe): potential bug. the mode of read IO is set as
+ DEFAULT_TEXTMODE in call of io_set_encoding(), and of write IO is
+ also set as it in call of io_new_instance() via rb_protect().
+ so, if DEFAULT_TEXTMODE is not 0, we should check the result of
+ extract_binmode() and avoid crush of default IO mode and the result.
+
Tue May 31 13:00:17 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* strftime.c (rb_strftime_with_timespec): improved style consistency.
diff --git a/io.c b/io.c
index 4e1945c549..cddab6aa00 100644
--- a/io.c
+++ b/io.c
@@ -8115,7 +8115,15 @@ rb_io_s_pipe(int argc, VALUE *argv, VALUE klass)
rb_io_synchronized(fptr2);
extract_binmode(opt, &fmode);
+#if DEFAULT_TEXTMODE
+ if ((fptr->mode & FMODE_TEXTMODE) && (fmode & FMODE_BINMODE))
+ fptr->mode &= ~FMODE_TEXTMODE;
+#endif
fptr->mode |= fmode;
+#if DEFAULT_TEXTMODE
+ if ((fptr2->mode & FMODE_TEXTMODE) && (fmode & FMODE_BINMODE))
+ fptr2->mode &= ~FMODE_TEXTMODE;
+#endif
fptr2->mode |= fmode;
ret = rb_assoc_new(r, w);