Jarkko Hietaniemi wrote: > In perl.git, the branch smoke-me/jhi/binary has been created > > <http://perl5.git.perl.org/perl.git/commitdiff/6967578d557f8f962ecc5e926e4169b05a89e602?hp=0000000000000000000000000000000000000000> > > at 6967578d557f8f962ecc5e926e4169b05a89e602 (commit) > > - Log ----------------------------------------------------------------- > commit 6967578d557f8f962ecc5e926e4169b05a89e602 > Author: Jarkko Hietaniemi <jhi@iki.fi> > Date: Mon Jun 2 09:57:28 2014 -0400 > > 38d96942 missed a side-effect in PerlIO_open flags parsing. > > The mode++ was essential in allowing 'rb' for the PerlIO_open() flags. > Strangely enough, nothing else so far than Compress::Bzip2 caught that: > https://rt.perl.org/Ticket/Display.html?id=122012 > Without the mode++ the 'b' was left unprocessed and this caused > the oflags to become bogus. > > There's no "unit testing" of PerlIO as such. Sigh. > > While doing this, realized that for the "O_BINARY vs O_TEXT" it's > probably the clearest to test for the non-zero-ness of them. > ----------------------------------------------------------------------- > > -- > Perl5 Master Repository Maybe its better to revert all the Coverity fixes for this area, since the Coverity complaint was unreachable code and not something more serious. ------------------------- + /* bit-and:ing with zero O_BINARY or O_TEXT would be useless. */ +# if O_BINARY != 0 if (mode & O_BINARY) o->op_private |= OPpOPEN_IN_RAW; - else if (mode & O_TEXT) +# endif +# if O_TEXT != 0 + if (mode & O_TEXT) o->op_private |= OPpOPEN_IN_CRLF; +# endif -------------------------- The #ifs are bizarre and trying too hard.