diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | io.c | 8 |
2 files changed, 16 insertions, 0 deletions
@@ -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. @@ -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); |