summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorVincent Pit <perl@profvince.com>2008-04-29 21:33:21 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-04-30 08:17:51 +0000
commita79b25b7e1c39b559797e18bb4d3e057a9f962f0 (patch)
tree94828323b69ff7f85ff2ae6309a005549a5247c2 /pp_sys.c
parent9c2a5cfebcaca6cb620772a695fd0f59629bfdf5 (diff)
downloadperl-a79b25b7e1c39b559797e18bb4d3e057a9f962f0.tar.gz
Double magic/warnings with binmode $fh, undef
From: "Vincent Pit" <perl@profvince.com> Message-ID: <63615.92.128.97.94.1209490401.squirrel@92.128.97.94> p4raw-id: //depot/perl@33766
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 59439e9f17..94549ed48d 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -762,8 +762,12 @@ PP(pp_binmode)
PUTBACK;
{
- const int mode = mode_from_discipline(discp);
- const char *const d = (discp ? SvPV_nolen_const(discp) : NULL);
+ STRLEN len = 0;
+ const char *d = NULL;
+ int mode;
+ if (discp)
+ d = SvPV_const(discp, len);
+ mode = mode_from_discipline(d, len);
if (PerlIO_binmode(aTHX_ fp, IoTYPE(io), mode, d)) {
if (IoOFP(io) && IoOFP(io) != IoIFP(io)) {
if (!PerlIO_binmode(aTHX_ IoOFP(io), IoTYPE(io), mode, d)) {