diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-05-29 11:18:24 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-05-29 11:25:50 -0400 |
commit | 38d96942f24ac1d656ec071bbbe8217808596d6c (patch) | |
tree | d64b3ff98abcc1d51305ab5173bd4335d46a70b0 /perlio.c | |
parent | 5edb797598c6396fc75c9b382b15dbde7e3f5711 (diff) | |
download | perl-38d96942f24ac1d656ec071bbbe8217808596d6c.tar.gz |
O_BINARY versus O_TEXT.
O_BINARY and O_TEXT can be either different (mostly in Windowsy platforms,
and in some hybrids, and then they can be either effective or no-ops);
or equal (in UNIXy platforms, no-ops). If they are no-ops, and especially
if one or both of them are zeros, one cannot even test for them (bit-and),
without introducing dead/non-sensical code.
[perl #121739]
Fix for Coverity perl5 CID 28948:
Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement mode[ix++] = 'b';
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -199,8 +199,10 @@ PerlIO_intmode2str(int rawmode, char *mode, int *writing) mode[ix++] = '+'; } } +#ifdef PERLIO_BINARY_AND_TEXT_DIFFERENT_AND_EFFECTIVE if (rawmode & O_BINARY) mode[ix++] = 'b'; +#endif mode[ix] = '\0'; return ptype; } @@ -2529,6 +2531,7 @@ PerlIOUnix_oflags(const char *mode) oflags |= O_WRONLY; break; } +#ifdef PERLIO_BINARY_AND_TEXT_DIFFERENT_AND_EFFECTIVE if (*mode == 'b') { oflags |= O_BINARY; oflags &= ~O_TEXT; @@ -2540,14 +2543,13 @@ PerlIOUnix_oflags(const char *mode) mode++; } else { -#ifdef PERLIO_USING_CRLF /* * If neither "t" nor "b" was specified, open the file * in O_BINARY mode. */ oflags |= O_BINARY; -#endif } +#endif if (*mode || oflags == -1) { SETERRNO(EINVAL, LIB_INVARG); oflags = -1; |