1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2011-05-31 05:21:36 +00:00
parent 8fa30bbd48
commit da1db8b454
2 changed files with 16 additions and 0 deletions

View file

@ -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.

8
io.c
View file

@ -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);