ruby-changes:19814
From: usa <ko1@a...>
Date: Tue, 31 May 2011 14:21:46 +0900 (JST)
Subject: [ruby-changes:19814] usa:r31859 (trunk): * io.c (rb_io_s_pipe): potential bug. the mode of read IO is set as
usa 2011-05-31 14:21:36 +0900 (Tue, 31 May 2011) New Revision: 31859 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31859 Log: * 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. Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 31858) +++ ChangeLog (revision 31859) @@ -1,3 +1,11 @@ +Tue May 31 14:17:49 2011 NAKAMURA Usaku <usa@r...> + + * 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@y...> * strftime.c (rb_strftime_with_timespec): improved style consistency. Index: io.c =================================================================== --- io.c (revision 31858) +++ io.c (revision 31859) @@ -8115,7 +8115,15 @@ 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/