diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-31 05:21:36 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-31 05:21:36 +0000 |
commit | da1db8b454c6f8f0714d762c72815cf73efba4d8 (patch) | |
tree | 41673f8ab9001cd3acba0eb864690cec3bd0f3b6 /io.c | |
parent | 8fa30bbd48dd73d711961b226ef62780c21a96be (diff) |
* 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
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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); |